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

📄 rsaprivatekey.java

📁 对称和非对称加密
💻 JAVA
字号:
package com.dmgc.security.cipher.unsymmetic.rsa;import java.io.Serializable;/** * <p>Title: DMGC SECURITY CIPHER LIB</p> * <p>Description: 上海信宁科技有限公司 安全密码库(JAVA version)</p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: 上海信宁科技有限公司</p> * <p>RSA 私钥结构 * <p>n为RSA模 * <p>e为RSA加密指数 * <p>d为RSA解密指数 类型1 * <p>类型2 RSA的解密指数为 d1,d2,p,q,coefficient * @author 陆荣幸  周渊   潘勇 * @version 1.0 */public class RSAPrivateKey implements Serializable {  /**   * RSA 加密算法的版本类型,这里版本为RSA1024   */  private String version = "RSA 1024  version 1.0" ;  /**   * RSA 算法类型,如果type = 1,则私钥为d. type = 2 则私钥为d1 d2 p q co   */  private String type =  "1";  /**   * RSA 算法中大整数模 这里 n 为1024比特   */  private com.dmgc.security.cipher.util.DmgcMpInteger modulus;  /**   * RSA 算法中的加密指数 e   */  private com.dmgc.security.cipher.util.DmgcMpInteger publicExponent;  /**   * RSA 算法中的解密指数 d   */  private com.dmgc.security.cipher.util.DmgcMpInteger privateExponent;  /**   * RSA 算法中的第一个大素数P 这里为512比特   */  private com.dmgc.security.cipher.util.DmgcMpInteger primeP;  /**   * RSA 算法中的第二个大素数Q 这里为512比特   */  private com.dmgc.security.cipher.util.DmgcMpInteger primeQ;  /**   * RSA 算法中的第一个素数指数幂 d mod (p-1)   */  private com.dmgc.security.cipher.util.DmgcMpInteger exponentP;  /**   * RSA 算法中的第二个素数指数幂 d mod (q-1)   */  private com.dmgc.security.cipher.util.DmgcMpInteger exponentQ;  /**   * RSA 这个素数的逆元 q*qInf = 1 (mod p)   */  private com.dmgc.security.cipher.util.DmgcMpInteger coefficient;  /**   * RSA私钥的构造函数   */  public RSAPrivateKey() {  }  /**   * 用于测试   * @param args   */  public static void main(String[] args) {    RSAPrivateKey RSAPrivateKey1 = new RSAPrivateKey();  }  /**   * 得到RSA 算法的版本   * @return version   */  public String getVersion() {    return version;  }  /**   * 得到RSA 算法的类型   * @return 1 表示类型1 私钥为d   */  public String getType() {    return type;  }  /**   * 设置RSA 算法的类型   * @param type  1 或 2   */  public void setType(String type) {    this.type = type;  }  /**   * 取得大整数模n  n = pq   * @return n   */  public com.dmgc.security.cipher.util.DmgcMpInteger getModulus() {    return modulus;  }  /**   * 设置大整数模n n=pq  这里 n为1024比特   * @param modulus   */  public void setModulus(com.dmgc.security.cipher.util.DmgcMpInteger modulus) {    this.modulus = modulus;  }  /**   * 取得加密指数e   * @return e   */  public com.dmgc.security.cipher.util.DmgcMpInteger getPublicExponent() {    return publicExponent;  }  /**  * 设置加密指数e  * @param publicExponent  */  public void setPublicExponent(com.dmgc.security.cipher.util.DmgcMpInteger publicExponent) {    this.publicExponent = publicExponent;  }  /**   * 取得解密指数d   * @return d   */  public com.dmgc.security.cipher.util.DmgcMpInteger getPrivateExponent() {    return privateExponent;  } /**  * 设置解密指数d  * @param publicExponent  */  public void setPrivateExponent(com.dmgc.security.cipher.util.DmgcMpInteger privateExponent) {    this.privateExponent = privateExponent;  }  /**   * 取得大素数p   * @return p   */  public com.dmgc.security.cipher.util.DmgcMpInteger getPrimeP() {    return primeP;  }  /**   * 设置大素数P   * @param primeP   */  public void setPrimeP(com.dmgc.security.cipher.util.DmgcMpInteger primeP) {    this.primeP = primeP;  }  /**   * 取得大素数P   * @return P    P为512   */  public com.dmgc.security.cipher.util.DmgcMpInteger getPrimeQ() {    return primeQ;  }  /**   * 设置大素数Q   * @param primeQ   */  public void setPrimeQ(com.dmgc.security.cipher.util.DmgcMpInteger primeQ) {    this.primeQ = primeQ;  }  /**   * 取得d1   d1 (mod p-1)   * @return d1   */  public com.dmgc.security.cipher.util.DmgcMpInteger getExponentP() {    return exponentP;  }  /**   * 设置d1   d (mod p-1)   * @param exponentP   */  public void setExponentP(com.dmgc.security.cipher.util.DmgcMpInteger exponentP) {    this.exponentP = exponentP;  }  /**   * 取得d2   d (mod q-1)   * @param exponentQ   */  public com.dmgc.security.cipher.util.DmgcMpInteger getExponentQ() {    return exponentQ;  }  /**   * 设置d2   d (mod q-1)   * @param exponentQ   */  public void setExponentQ(com.dmgc.security.cipher.util.DmgcMpInteger exponentQ) {    this.exponentQ = exponentQ;  }  /**   * 取得 q invert in p   * @return infq   */  public com.dmgc.security.cipher.util.DmgcMpInteger getCoefficient() {    return coefficient;  }  /**   * 设置q invert in Q   * @param coefficient   */  public void setCoefficient(com.dmgc.security.cipher.util.DmgcMpInteger coefficient) {    this.coefficient = coefficient;  }}

⌨️ 快捷键说明

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