⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e200. getting the digital signature algorithm (dsa) parameters of a key pair.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
The DSA requires three parameters to create a key pair --- the prime (P), the subprime (Q), and the base (G). These three values are used to create a private key (called X) and a public key (called Y). 
This example creates a DSA key pair with provider-supplied default values for P, Q, and G, and then retrieves the default values. 

    try {
        // Generate a 1024-bit Digital Signature Algorithm (DSA) key pair
        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA");
        keyGen.initialize(1024);
        KeyPair keypair = keyGen.genKeyPair();
        DSAPrivateKey privateKey = (DSAPrivateKey)keypair.getPrivate();
        DSAPublicKey publicKey = (DSAPublicKey)keypair.getPublic();
    
        // Get p, q, g; they are the same for both private and public keys
        DSAParams dsaParams = privateKey.getParams();
        BigInteger p = dsaParams.getP();
        BigInteger q = dsaParams.getQ();
        BigInteger g = dsaParams.getG();
    
        // Get the private key's X
        BigInteger x = privateKey.getX();
    
        // Get the public key's Y
        BigInteger y = publicKey.getY();
    } catch (NoSuchAlgorithmException e) {
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -