EncryptedPrivateKeyInfo ::= SEQUENCE { encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}}, encryptedData EncryptedData } EncryptedData ::= OCTET STRING KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= { ... -- For local profiles }
7071727374757677787980
ByteArrayOutputStream out = new ByteArrayOutputStream(); ASN1OutputStream asn1Out = new ASN1OutputStream(out); ASN1Object spnegoOIDASN1 = (ASN1Object) spnegoOid.toASN1Object(); ASN1Object taggedSpnegoASN1 = (ASN1Object) taggedSpnego.toASN1Object(); int length = spnegoOIDASN1.getDEREncoded().length + taggedSpnegoASN1.getDEREncoded().length; byte [] lenBytes = writeLength(length); byte[] appWrap = new byte[lenBytes.length + 1];
8384858687888990919293
appWrap[i] = lenBytes[i-1]; } asn1Out.write(appWrap); asn1Out.writeObject(spnegoOid.toASN1Object()); asn1Out.writeObject(taggedSpnego.toASN1Object()); byte[] app = out.toByteArray(); ASN1InputStream in = new ASN1InputStream(app); if( LOG.isDebugEnabled() ){
7273747576777879808182
8586878889909192939495
appWrap[i] = lenBytes[i-1]; } asn1Out.write(appWrap); asn1Out.writeObject(spnegoOid.toASN1Object()); asn1Out.writeObject(taggedSpnego.toASN1Object()); byte[] app = out.toByteArray(); ASN1InputStream in = new ASN1InputStream(app); if (log.isDebugEnabled() ){
177178179180181182183184185186187
EncryptedPrivateKeyInfo encInfo = EncryptedPrivateKeyInfo.getInstance((ASN1Sequence)b.getBagValue()); encInfo = new EncryptedPrivateKeyInfo(encInfo.getEncryptionAlgorithm(), encInfo.getEncryptedData()); b = new SafeBag(PKCSObjectIdentifiers.pkcs8ShroudedKeyBag, encInfo.toASN1Object(), b.getBagAttributes()); ByteArrayOutputStream abOut = new ByteArrayOutputStream(); ASN1OutputStream berOut = new ASN1OutputStream(abOut); berOut.writeObject(new DERSequence(b));