RSAPublicKey.java
资源名称:security.rar [点击查看]
上传用户:lior1029
上传日期:2013-05-07
资源大小:209k
文件大小:1k
源码类别:
CA认证
开发平台:
Java
- package org.infosecurity.cryptography;
- /**
- * <p>Title: RSA的公钥类 </p>
- * <p>Description: RSA的公钥结构 </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: 中信信息安全组织(CISO) </p>
- * @author 张荣华
- * @version 1.0.2003.0704
- */
- import java.math.BigInteger;
- import java.security.SecureRandom;
- import org.bouncycastle.asn1.*;
- import org.bouncycastle.asn1.pkcs.*;
- public class RSAPublicKey extends Object implements java.io.Serializable {
- private BigInteger modulus;
- private BigInteger exponent;
- public RSAPublicKey(
- BigInteger modulus,
- BigInteger exponent)
- {
- this.modulus = modulus;
- this.exponent = exponent;
- }
- public BigInteger getModulus()
- {
- return modulus;
- }
- public BigInteger getExponent()
- {
- return exponent;
- }
- public void setModules(BigInteger modulus)
- {
- this.modulus = modulus;
- }
- public void setExponent(BigInteger exponent)
- {
- this.exponent = exponent;
- }
- /**
- * 进行DER编码
- * @author 张荣华
- */
- public DERObject getDERObject()
- {
- ASN1EncodableVector v = new ASN1EncodableVector();
- v.add(new DERInteger(getModulus()));
- v.add(new DERInteger(getExponent()));
- return new DERSequence(v);
- }
- public static void main(String[] args) {
- //RSAPublicKey puk = new RSAPublicKey();
- }
- }