EncryptedPrivateKeyInfo.java
资源名称:security.rar [点击查看]
上传用户:lior1029
上传日期:2013-05-07
资源大小:209k
文件大小:1k
源码类别:
CA认证
开发平台:
Java
- package org.bouncycastle.asn1.pkcs;
- import java.io.*;
- import java.util.Enumeration;
- import java.math.BigInteger;
- import org.bouncycastle.asn1.*;
- import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
- public class EncryptedPrivateKeyInfo
- implements PKCSObjectIdentifiers, DEREncodable
- {
- private AlgorithmIdentifier algId;
- private ASN1OctetString data;
- public EncryptedPrivateKeyInfo(
- ASN1Sequence seq)
- {
- Enumeration e = seq.getObjects();
- algId = new AlgorithmIdentifier((ASN1Sequence)e.nextElement());
- data = (ASN1OctetString)e.nextElement();
- }
- public EncryptedPrivateKeyInfo(
- AlgorithmIdentifier algId,
- byte[] encoding)
- {
- this.algId = algId;
- this.data = new DEROctetString(encoding);
- }
- public AlgorithmIdentifier getEncryptionAlgorithm()
- {
- return algId;
- }
- public byte[] getEncryptedData()
- {
- return data.getOctets();
- }
- /**
- * EncryptedPrivateKeyInfo ::= SEQUENCE {
- * encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
- * encryptedData EncryptedData
- * }
- *
- * EncryptedData ::= OCTET STRING
- *
- * KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
- * ... -- For local profiles
- * }
- */
- public DERObject getDERObject()
- {
- ASN1EncodableVector v = new ASN1EncodableVector();
- v.add(algId);
- v.add(data);
- return new DERSequence(v);
- }
- }