我正在尝试在Windows 2012 R2上配置IIS 8.5,以便我不会从Chrome获得该网站使用过时加密的通知.下图来自Mac OS X,但我在Windows 8.1中收到类似的消息,其中加密算法为AES_256_CBC,使用SHA1散列,密钥交换为ECDHE_RSA.问题是SHA1消息散列.谷歌正试图让网站使用SHA2消息哈希.在Mac上,使用的算法是SHA256用于散列签名,但这里的问题是AES加密的GCM修饰符.
我有一个新的证书,即支持SHA256消息散列的2048位RSA证书.
我使用NARTAC IIS加密工具来配置IIS服务器.启用的协议是TLS 1.0,TLS 1.1和TLS 1.2启用的密码是TripleDES 168,AES 12/128和AES 256/256.哈希启用的是SHA,SHA256,SHA384和SHA512.启用的密钥交换是Diffie-Hellman,PKCS和ECDH.已启用套件的SSL密码套件订单包括:
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P384 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P521(它确实是这样,在最新的工具)TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P521 TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P521 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P384 TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256 TLS_RSA_WITH_AES_256_GCM_SHA384
TLS_RSA_WITH_AES_128_GCM_SHA256
我已尝试过此配置的大量变体,但没有一个导致Chrome的通知消失的工作网站.如果我从密码启用中删除AES 128/128,它似乎没有任何影响.如果我从已启用哈希中删除SHA,则该网站无法与为网站提供数据服务的SQL Server 2012进行通信.如果我从支持的订单中删除基于SHA1的SSL密码套件,则浏览器无法连接到服务器.
有没有人使用SQL Server的Windows IIS 8.5工作配置,Chrome通知消失了?
我google了很多,很多答案都是肯定的.例如:GET数据是否也在HTTPS中加密? 但我们公司的高级安全工程师告诉我,URL不会被加密.
图像,如果URL已加密,DNS服务器如何找到主机并连接?
我认为这是非常强大的观点,尽管它反对大多数答案.所以我真的很困惑,我的问题是:
我尝试访问https://www.amazon.com/gp/css/homepage.html/ref=ya_surl_youracct,我的IE向服务器发送了两个请求:
第一:
CONNECT www.amazon.com:443 HTTP/1.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: www.amazon.com
Content-Length: 0
DNT: 1
Connection: Keep-Alive
Pragma: no-cache
Run Code Online (Sandbox Code Playgroud)
第二:
GET /gp/css/homepage.html/ref=ya_surl_youracct HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: en-US,zh-CN;q=0.5
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Host: www.amazon.com
DNT: 1
Connection: Keep-Alive
Run Code Online (Sandbox Code Playgroud)
我的浏览器似乎已经请求了两次:第一次是与主机建立连接(没有加密),第二次是通过https发送加密请求?我对吗?如果我正确理解这一点,当客户端使用https调用RESTFUL API时,它每次都会发送两次请求(连接和获取/发布)?
目前,当我使用以下方法创建密钥时
private KeyPair getKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDsA", "SC");
ECGenParameterSpec ecSpec = new ECGenParameterSpec("secp256k1");
keyGen.initialize(ecSpec, new SecureRandom());
return keyGen.generateKeyPair();
}
Run Code Online (Sandbox Code Playgroud)
KeyPairGenerator有另一种方法,我可以在其中指定keySize,但我不知道如何通过ecSpec.
public void initialize(int keysize, SecureRandom random)
Run Code Online (Sandbox Code Playgroud) 几周前,我在这篇文章中得到了完美的工作: 适用于Java和Javascript的兼容AES算法
现在,我需要进行相反的操作,但是在java中,我得到了这个异常:
javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
Run Code Online (Sandbox Code Playgroud)
这是我在JavaScript中执行的"反向"操作:
var rkEncryptionKey = CryptoJS.enc.Base64.parse('u/Gu5posvwDsXUnV5Zaq4g==');
var rkEncryptionIv = CryptoJS.enc.Base64.parse('5D9r9ZVzEYYgha93/aUK2w==');
function encryptString(stringToEncrypt) {
var utf8Stringified = CryptoJS.enc.Utf8.parse(stringToEncrypt);
var encrypted = CryptoJS.AES.encrypt(utf8Stringified.toString(), rkEncryptionKey, {mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7, iv: rkEncryptionIv});
return CryptoJS.enc.Base64.parse(encrypted.toString()).toString();
}
Run Code Online (Sandbox Code Playgroud)
我虽然这就是全部?
[编辑]
加密字符串如下: {"company_name":"asdfasdfasd","customer_name":"asdfasdfasdfasdf","phone_number":"asdfasdfasdfasdf","email":"asdfasdfasdfasdfads"}
当从java到java进行加密/解密时,它可以工作,当从java到javascript这样做时,也可以工作,但是从javascript到java,不能正常工作.
Java代码
public String toJson(final String encrypted) {
try {
SecretKey key = new SecretKeySpec(Base64.decodeBase64("u/Gu5posvwDsXUnV5Zaq4g=="), "AES");
AlgorithmParameterSpec iv = new IvParameterSpec(Base64.decodeBase64("5D9r9ZVzEYYgha93/aUK2w=="));
byte[] decodeBase64 = Base64.decodeBase64(encrypted);
Cipher cipher = …Run Code Online (Sandbox Code Playgroud) 是否可以解密通过PowerShell加密的C#中的字符串以及如何?
该字符串通过PowerShell加密,如下所示:
$pw = read-host "Enter Password" –AsSecureString
ConvertFrom-SecureString $pw | out-file "C:\file.txt"
Run Code Online (Sandbox Code Playgroud)
要使用PowerShell将其转换回来,我可以使用这些调用C#类的命令System.Runtime.InteropServices.Marshal.
$pwdSec = Get-Content "C:\file.txt" | ConvertTo-SecureString
$bPswd = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pwdSec)
$pswd = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($bPswd)
Run Code Online (Sandbox Code Playgroud)
文件包含已转换为加密标准的字符串string("hello").
因此,如果打开file.txt文件,它看起来类似于:
01000000d08c9ddf0115d1118c7a00c04fc297eb0100000052ded6c2db80e748933432e19b9de8b10000
000002000000000003660000c00000001000000016dc35885d76d07bab289eb9927cfc1e000000000480
0000a0000000100000003106cde553f45b08d13d89d11336170b280000005cc865c1ee1b57e84ed3d1a2
d3f2d0ec0f189b532e61c18d1f31444d6f119a1e8368477fd2d81f54140000000cb0262e58b08ae14f37
22c14c69684841b6b21c
Run Code Online (Sandbox Code Playgroud) 我们正在系统中删除大量共享功能并将其移植到PCL库中.我在使用PCLCrypto时遇到了问题.我正在我们的数据库中获取一些现有数据,并尝试使用相同的算法对其进行解密.我得到了值,但最后有16个额外的字节只是垃圾.
请参阅下面的代码: 使用System.Security.Cryptography的旧算法
public static string SymmetricEncrypt(this string plaintext, string key, SymmetricAlgorithm algorithm)
{
byte[] keyBuffer = Convert.FromBase64String(key.Hash(HashAlgorithm.MD5));
byte[] plainTextBuffer = Encoding.UTF8.GetBytes(plaintext);
var symmetricAlgorithm = new AesCryptoServiceProvider();
symmetricAlgorithm.Key = keyBuffer;
symmetricAlgorithm.Mode = CipherMode.ECB;
var encryptor = symmetricAlgorithm.CreateEncryptor();
byte[] cipherBuffer = encryptor.TransformFinalBlock(plainTextBuffer, 0, plainTextBuffer.Length);
symmetricAlgorithm.Clear();
return Convert.ToBase64String(cipherBuffer);
}
public static string SymmetricDecrypt(this string cipherText, string key, SymmetricAlgorithm algorithm)
{
byte[] keyBuffer = Convert.FromBase64String(key.Hash(HashAlgorithm.MD5));
byte[] cipherTextBuffer = Convert.FromBase64String(cipherText);
var symmetricAlgorithm = new AesCryptoServiceProvider();
symmetricAlgorithm.Key = keyBuffer;
symmetricAlgorithm.Mode = CipherMode.ECB;
var decryptor = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用amazon aws进行加密和解密.我有例外
Exception in thread "main" com.amazonaws.AmazonClientException: Unable to build cipher: Illegal key size
Make sure you have the JCE unlimited strength policy files installed and configured for your JVM
at com.amazonaws.services.s3.internal.crypto.ContentCryptoScheme.createCipherLite(ContentCryptoScheme.java:190)
at com.amazonaws.services.s3.internal.crypto.ContentCryptoMaterial.wrap(ContentCryptoMaterial.java:823)
at com.amazonaws.services.s3.internal.crypto.S3CryptoModuleBase.buildContentCryptoMaterial(S3CryptoModuleBase.java:535)
at com.amazonaws.services.s3.internal.crypto.S3CryptoModuleBase.newContentCryptoMaterial(S3CryptoModuleBase.java:483)
at com.amazonaws.services.s3.internal.crypto.S3CryptoModuleBase.createContentCryptoMaterial(S3CryptoModuleBase.java:449)
at com.amazonaws.services.s3.internal.crypto.S3CryptoModuleBase.putObjectUsingMetadata(S3CryptoModuleBase.java:165)
at com.amazonaws.services.s3.internal.crypto.S3CryptoModuleBase.putObjectSecurely(S3CryptoModuleBase.java:159)
at com.amazonaws.services.s3.internal.crypto.CryptoModuleDispatcher.putObjectSecurely(CryptoModuleDispatcher.java:107)
at com.amazonaws.services.s3.AmazonS3EncryptionClient.putObject(AmazonS3EncryptionClient.java:485)
at testKMSkeyUploadObject.main(testKMSkeyUploadObject.java:91)
Caused by: java.security.InvalidKeyException: Illegal key size
at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
at javax.crypto.Cipher.implInit(Cipher.java:805)
at javax.crypto.Cipher.chooseProvider(Cipher.java:864)
at javax.crypto.Cipher.init(Cipher.java:1396)
at javax.crypto.Cipher.init(Cipher.java:1327)
at com.amazonaws.services.s3.internal.crypto.ContentCryptoScheme.createCipherLite(ContentCryptoScheme.java:187)
... 9 more
please help me.
Run Code Online (Sandbox Code Playgroud)
当我试图将对象用于使用AmazonS3EncryptionClient进行加密时,我得到了异常.如何解决此错误.
AmazonS3EncryptionClient s3 = new AmazonS3EncryptionClient(credentials,materialProvider); …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
<div id="decrypted">Please wait...</div>
Insert new note:<input type="text" id="new_note"><input type="button" id="enc_button" value="Save">
<script>
var password = "testpassword";
var encrypted_text = localStorage.getItem("encrypted");
var rawData = atob(encrypted_text);
var iv = rawData.substring(0,16);
var crypttext = rawData.substring(16);
var plaintextArray = CryptoJS.AES.decrypt(
{ ciphertext: CryptoJS.enc.Latin1.parse(crypttext) },
CryptoJS.enc.Hex.parse(password),
{ iv: CryptoJS.enc.Latin1.parse(iv) }
);
var decrypted = CryptoJS.enc.Latin1.stringify(plaintextArray);
document.getElementById("decrypted").innerHTML = decrypted;
document.getElementById("enc_button").onclick = function(){
var text = document.getElementById("new_note").value;
var encrypted = CryptoJS.AES.encrypt(text, password);
localStorage.setItem("encrypted",encrypted);
}
</script>Run Code Online (Sandbox Code Playgroud)
使用CryptoJS使用AES加密字符串; 解密保存在本地存储中的加密文本,并将结果显示在div中
虽然字符串似乎已加密,但变量decrypt为空.Chrome控制台中未触发任何错误.
我用低于此值的文件(10mb,100mb,500mb)测试了我的代码,加密工作正常.但是,我遇到了大于1GB的文件的问题.我已经生成了一个大文件(大约2GB),我想用AES使用JAVA加密它,但我遇到了这个错误:
"线程中的异常"主"java.lang.OutOfMemoryError:Java堆空间"
我尝试使用-Xmx8G增加可用内存,但没有骰子.我的部分代码如下
File selectedFile = new File("Z:\\dummy.txt");
Path path = Paths.get(selectedFile.getAbsolutePath());
byte[] toencrypt = Files.readAllBytes(path);
byte[] ciphertext = aesCipherForEncryption.doFinal(toencrypt);
FileOutputStream fos = new FileOutputStream(selectedFile.getAbsolutePath());
fos.write(ciphertext);
fos.close();
Run Code Online (Sandbox Code Playgroud)
据我所知,它的行为方式是,它试图立即读取整个文件,加密它,并将其存储到另一个字节数组中,而不是缓冲和流式传输.任何人都可以帮助我一些代码提示?
我是编码的初学者,所以我真的不太了解,任何帮助都将受到赞赏.
encryption ×10
java ×4
c# ×2
cryptojs ×2
.net ×1
aes ×1
amazon-s3 ×1
android ×1
bouncycastle ×1
cryptography ×1
dns ×1
ecdsa ×1
encoding ×1
https ×1
iis ×1
javascript ×1
laravel ×1
laravel-5 ×1
netbeans-8 ×1
pcl-crypto ×1
powershell ×1
securestring ×1
security ×1
sha ×1
url ×1