标签: rsa

在哪里使用 RSA?

有人请说明 RSA 算法的两个或三个应用。我听说 RSA 用于 SSL。真的吗?

rsa encryption-asymmetric public-key-encryption

-1
推荐指数
1
解决办法
2067
查看次数

"javax.crypto.BadPaddingException:数据必须从零开始"异常

我在解密字符串时遇到了上述异常.

以下是我的代码:

import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;

public class EncryptAndDecrypt {

    public static Cipher createCipher () throws Exception{

            Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");

            return cipher;
    }
    public static KeyPair generateKey () throws  NoSuchAlgorithmException{

            KeyPairGenerator keyGen = KeyPairGenerator.getInstance ("RSA");
            keyGen.initialize(1024);
            KeyPair key = keyGen.generateKeyPair();

            return key;
    }
    public static byte [] encrypt (String  str, Cipher cip, KeyPair key) {

        byte [] cipherText = null;
        try {

            byte [] plainText = str.getBytes("UTF8");
            cip.init(Cipher.ENCRYPT_MODE, key.getPublic());
            cipherText = cip.doFinal(plainText);
        } catch (Exception …
Run Code Online (Sandbox Code Playgroud)

java rsa

-2
推荐指数
1
解决办法
2万
查看次数

如何加密/解密字符串?

关注这个问题,我想知道RSA的关键是什么,以及如何在C#中创建和使用它.

c# cryptography rsa

-3
推荐指数
1
解决办法
1341
查看次数

这种C#代码对于分类数据的RSA加密是否安全?

我将加密CLASSIFIED数据,我的数据必须使用最先进的加密保护.我使用AES加密数据,使用RSA加密密钥.我的RSA代码如下.请确认此代码是否安全:

  static class Program
  {
    static void Main()
    {
      var csp = new RSACryptoServiceProvider(3072);
      var privKey = csp.ExportParameters(true);
      var pubKey = csp.ExportParameters(false);
      string pubKeyString;
      {
        var sw = new System.IO.StringWriter();
        var xs = new System.Xml.Serialization.XmlSerializer(typeof(RSAParameters));
        xs.Serialize(sw, pubKey);
        pubKeyString = sw.ToString();
      }
  {
    //get a stream from the string
    var sr = new System.IO.StringReader(pubKeyString);
    //we need a deserializer
    var xs = new System.Xml.Serialization.XmlSerializer(typeof(RSAParameters));
    //get the object back from the stream
    pubKey = (RSAParameters)xs.Deserialize(sr);
  }
  csp = new RSACryptoServiceProvider();
  csp.ImportParameters(pubKey);
  var plainTextData …
Run Code Online (Sandbox Code Playgroud)

c# security encryption cryptography rsa

-3
推荐指数
1
解决办法
562
查看次数

C#中的Mod运算符

C# 中是否有用于 RSA 算法的 mod 运算符?我一直在使用 % ,因为我认为这可以用作 mod,但是我得到的 c 和 m 的答案不正确,所以我意识到 % 不起作用。

      double e = 13;
      double d; //decryption

      double de = 7; 

      d = ((de * euiler) + 1) / e;

      double message = 25;
      double c = Pow(message, e) % n;
      double m = Pow(c, d) % n;
Run Code Online (Sandbox Code Playgroud)

c# rsa mod

-3
推荐指数
1
解决办法
232
查看次数

CTF RSA 解密使用 N, c, e

给出 N, e, c 如下:

n = 35390004486354300347521848565413257959442624589297688131017877221807025004928966206454752329594506530598099849274956709610488234955109039874355077958460196991750855650029096905451

e = 65537

c = 34976328528100445602888072790831380493399287679380757676967266152942525578548886648293955777757882335796410272725253490310142371251759362170135820927390507970457244397459500624458
Run Code Online (Sandbox Code Playgroud)

我尝试了几种方法来解密它,比如factordbyafu甚至发现了一个类似的问题,它被RsaCtfTool解决了。也许我的电脑的性能很糟糕......有人可以帮忙吗?非常感谢!

encryption cryptography rsa ctf

-5
推荐指数
1
解决办法
9386
查看次数