标签: rsa

我的SSL证书应该使用什么RSA密钥长度?

我正在创建一个CSR,我想知道哪个可以说是我的RSA密钥的最佳长度.

当然,384可能太弱了,16384可能太慢了.

是否应该使用密钥长度达成共识,具体取决于证书的生命周期?

编辑:像大多数人一样,我希望我的钥匙能够相当强大.我并不担心国家安全局可能会在2019年破坏我的密钥.我只想知道当一个人计划做正常业务时最好的做法是什么(例如电子商务网站)

ssl cryptography rsa csr ssl-certificate

91
推荐指数
6
解决办法
8万
查看次数

85
推荐指数
4
解决办法
6万
查看次数

我用什么命令来查看服务器的ECDSA密钥指纹是什么?

我在Google上看到有关如何查看RSA密钥指纹的内容,而不是ECDSA指纹.

linux security ssh openssh rsa

68
推荐指数
4
解决办法
4万
查看次数

将SHA1和RSA与java.security.Signature与MessageDigest和Cipher一起使用

我试图了解Java java.security.Signature类的功能.如果我计算SHA1消息摘要,然后使用RSA加密该摘要,我得到一个不同的结果,要求Signature类签署相同的东西:

// Generate new key
KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
PrivateKey privateKey = keyPair.getPrivate();
String plaintext = "This is the message being signed";

// Compute signature
Signature instance = Signature.getInstance("SHA1withRSA");
instance.initSign(privateKey);
instance.update((plaintext).getBytes());
byte[] signature = instance.sign();

// Compute digest
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
byte[] digest = sha1.digest((plaintext).getBytes());

// Encrypt digest
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte[] cipherText = cipher.doFinal(digest);

// Display results
System.out.println("Input data: " + plaintext);
System.out.println("Digest: " + bytes2String(digest));
System.out.println("Cipher text: " + bytes2String(cipherText)); …
Run Code Online (Sandbox Code Playgroud)

java encryption cryptography rsa digital-signature

67
推荐指数
3
解决办法
10万
查看次数

如何通过RSA生成唯一的公钥和私钥

我正在构建一个自定义购物车,其中CC号和Exp日期将存储在数据库中,直到处理(然后删除).我需要加密这些数据(显然).

我想使用RSACryptoServiceProvider类.

这是我创建密钥的代码.

public static void AssignNewKey(){
    const int PROVIDER_RSA_FULL = 1;
    const string CONTAINER_NAME = "KeyContainer";
    CspParameters cspParams;
    cspParams = new CspParameters(PROVIDER_RSA_FULL);
    cspParams.KeyContainerName = CONTAINER_NAME;
    cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
    cspParams.ProviderName = "Microsoft Strong Cryptographic Provider";
    rsa = new RSACryptoServiceProvider(cspParams);

    string publicPrivateKeyXML = rsa.ToXmlString(true);
    string publicOnlyKeyXML = rsa.ToXmlString(false);
    // do stuff with keys...
}
Run Code Online (Sandbox Code Playgroud)

现在计划将私钥xml存储在连接到管理器密钥链的USB驱动器上.

每当经理离开公司时,我希望能够生成新的公钥和私钥(并使用新的公钥重新加密所有当前存储的CC号).

我的问题是这段代码生成的密钥总是一样的.我每次如何生成一组独特的密钥?

UPDATE.我的测试代码如下:
注意:这里的"privatekey"参数是原始私钥.为了更改密钥,我需要验证私钥是否有效.

在Default.aspx.cs中

public void DownloadNewPrivateKey_Click(object sender, EventArgs e)
{
    StreamReader reader = new StreamReader(fileUpload.FileContent);
    string privateKey = reader.ReadToEnd();
    Response.Clear();
    Response.ContentType = "text/xml"; …
Run Code Online (Sandbox Code Playgroud)

c# encryption cryptography rsa key

64
推荐指数
3
解决办法
11万
查看次数

如何从.NET读取PEM RSA私钥

我有格式的RSA私钥PEM,是否有直接的方式从.NET读取并实例化RSACryptoServiceProvider解密用相应的公钥加密的数据?

.net c# cryptography rsa

62
推荐指数
3
解决办法
11万
查看次数

RSA私钥密码如何在幕后工作?

可以为RSA私钥分配一个"密码",根据我的理解,它可以提供一些二级安全性,以防有人使用私钥文件.

如何实施密码短语安全层?

security encryption rsa

61
推荐指数
3
解决办法
6万
查看次数

如何从文件加载RSA私钥

我正在研究SAML 1.1断言消费者服务的测试工具.测试必须生成签名的SAMLResponse并将其提交给Base64中编码的ACS.ACS必须能够使用X509公共证书验证签名的消息.

我能够构建SAMLResponse,添加必要的断言等.但是当我尝试签署对象时,我遇到了问题.这是我当前代码的片段:

String certPath = "mycert.pem";
File pubCertFile = new File(certPath);
BufferedInputStream bis = null;
try {
    bis = new BufferedInputStream(new FileInputStream(pubCertFile));
} catch(FileNotFoundException e) {
    throw new Exception("Could not locate certfile at '" + certPath + "'", e);
}
CertificateFactory certFact = null;
Certificate cert = null;
try {
    certFact = CertificateFactory.getInstance("X.509");
    cert = certFact.generateCertificate(bis);
} catch(CertificateException e) {
    throw new Exception("Could not instantiate cert", e);
}
bis.close();
ArrayList<Certificate> certs = new ArrayList<Certificate>();
certs.add(cert);

String keyPath = "mykey.pem"; …
Run Code Online (Sandbox Code Playgroud)

java rsa saml

59
推荐指数
2
解决办法
10万
查看次数

C#RSA加密/解密与传输

我在C#网上看到了大量使用System.Security.Cryptography.RSACryptoServiceProvider的加密/解密教程和示例,但我希望能够做到的是:

  • 创建RSA公钥/私钥对
  • 传输公钥(或者为了概念验证,只需将其移动到字符串变量中)
  • 创建一个新的RSA加密提供程序并使用公钥加密字符串
  • 将加密的字符串(或数据)传回原始的加密提供程序并解密该字符串

有人能指点我这个有用的资源吗?

c# cryptography rsa

58
推荐指数
3
解决办法
10万
查看次数

.pem,.cer和.der之间有什么区别?

之间有什么区别.pem,.cer.der

据我所知,.cer包含公钥.是否有任何开放式框架可用于使用此公钥加密我的数据?

encryption cryptography rsa

55
推荐指数
2
解决办法
4万
查看次数