public ASN1Primitive toASN1Primitive() { return obj.toASN1Primitive(); } }
/** * Produce an object suitable for an ASN1OutputStream. */ public ASN1Primitive toASN1Primitive() { return id.toASN1Primitive(); } }
public BERConstructedOctetString( ASN1Encodable obj) { this(obj.toASN1Primitive()); }
public BERConstructedOctetString( ASN1Encodable obj) { this(obj.toASN1Primitive()); }
private byte[] getDEREncoded( ASN1Encodable obj) { try { return obj.toASN1Primitive().getEncoded(ASN1Encoding.DER); } catch (IOException e) { throw new IllegalArgumentException("cannot encode object added to SET"); } }
/** * Constructor from the encoding of an ASN.1 object. * * @param obj the object to be encoded. */ public DEROctetString( ASN1Encodable obj) throws IOException { super(obj.toASN1Primitive().getEncoded(ASN1Encoding.DER)); }
private byte[] encodeObj( ASN1Encodable obj) throws IOException { if (obj != null) { return obj.toASN1Primitive().getEncoded(); } return null; } }
private byte[] encodeObj( ASN1Encodable obj) throws IOException { if (obj != null) { return obj.toASN1Primitive().getEncoded(); } return null; }
int encodedLength() throws IOException { int length = 0; for (Enumeration e = getObjects(); e.hasMoreElements();) { length += ((ASN1Encodable)e.nextElement()).toASN1Primitive().encodedLength(); } return 2 + length + 2; }
int encodedLength() throws IOException { int length = 0; for (Enumeration e = getObjects(); e.hasMoreElements();) { length += ((ASN1Encodable)e.nextElement()).toASN1Primitive().encodedLength(); } return 2 + length + 2; }
public byte[] getCertHash() { if (otherCertHash.toASN1Primitive() instanceof ASN1OctetString) { // SHA-1 return ((ASN1OctetString)otherCertHash.toASN1Primitive()).getOctets(); } else { return DigestInfo.getInstance(otherCertHash).getDigest(); } }
int encodedLength() throws IOException { int length = 0; for (Enumeration e = getObjects(); e.hasMoreElements();) { length += ((ASN1Encodable)e.nextElement()).toASN1Primitive().encodedLength(); } return 2 + length + 2; }
public static byte[] getEncodedPrivateKeyInfo(AlgorithmIdentifier algId, ASN1Encodable privKey) { try { PrivateKeyInfo info = new PrivateKeyInfo(algId, privKey.toASN1Primitive()); return getEncodedPrivateKeyInfo(info); } catch (Exception e) { return null; } }
public static byte[] getEncodedPrivateKeyInfo(AlgorithmIdentifier algId, ASN1Encodable privKey) { try { PrivateKeyInfo info = new PrivateKeyInfo(algId, privKey.toASN1Primitive()); return getEncodedPrivateKeyInfo(info); } catch (Exception e) { return null; } }
public Evidence getTemporalEvidence() throws IOException { if (temporalEvidence == null) { temporalEvidence = Evidence.getInstance(parser.readObject().toASN1Primitive()); } return temporalEvidence; } }
public AlgorithmIdentifier getAlgorithmHash() { if (otherCertHash.toASN1Primitive() instanceof ASN1OctetString) { // SHA-1 return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1); } else { return DigestInfo.getInstance(otherCertHash).getAlgorithmId(); } }
public DERBitString( ASN1Encodable obj) throws IOException { super(obj.toASN1Primitive().getEncoded(ASN1Encoding.DER), 0); }
public EncryptedContentInfoParser( ASN1SequenceParser seq) throws IOException { _contentType = (ASN1ObjectIdentifier)seq.readObject(); _contentEncryptionAlgorithm = AlgorithmIdentifier.getInstance(seq.readObject().toASN1Primitive()); _encryptedContent = (ASN1TaggedObjectParser)seq.readObject(); }
public CompressedDataParser( ASN1SequenceParser seq) throws IOException { this._version = (ASN1Integer)seq.readObject(); this._compressionAlgorithm = AlgorithmIdentifier.getInstance(seq.readObject().toASN1Primitive()); this._encapContentInfo = new ContentInfoParser((ASN1SequenceParser)seq.readObject()); }
public PrivateKey generatePrivate(PrivateKeyInfo pki) throws IOException { // get the inner type inside the BIT STRING ASN1Primitive innerType = pki.parsePrivateKey().toASN1Primitive(); McElieceCCA2PrivateKey key = McElieceCCA2PrivateKey.getInstance(innerType); return new BCMcElieceCCA2PrivateKey(new McElieceCCA2PrivateKeyParameters(key.getN(), key.getK(), key.getField(), key.getGoppaPoly(), key.getP(), null)); }