EncryptedContentInfo ::= SEQUENCE { contentType ContentType, contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
182183184185186187188189190191192193194195196197198
throws Exception { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BerSequenceGenerator seqGen1 = new BerSequenceGenerator(bOut); seqGen1.addObject(new Asn1Integer(BigInteger.valueOf(0))); seqGen1.addObject(new Asn1ObjectIdentifier("1.1")); BerSequenceGenerator seqGen2 = new BerSequenceGenerator(seqGen1.getRawOutputStream()); seqGen2.addObject(new Asn1Integer(BigInteger.valueOf(1))); seqGen2.close(); seqGen1.close();
314315316317318319320321322323324
throws Exception { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); BerSequenceGenerator seqGen = new BerSequenceGenerator(bOut, 1, true); seqGen.addObject(new Asn1Integer(BigInteger.valueOf(0))); seqGen.addObject(new Asn1ObjectIdentifier("1.1")); seqGen.close();
143144145146147148149150151152153
sGen.addObject(new Asn1ObjectIdentifier(CMSObjectIdentifiers.compressedData.getId())); BerSequenceGenerator cGen = new BerSequenceGenerator(sGen.getRawOutputStream(), 0, true); cGen.addObject(new Asn1Integer(0)); // // AlgorithmIdentifier // DerSequenceGenerator algGen = new DerSequenceGenerator(cGen.getRawOutputStream());
8889909192939495969798
} public Asn1Set getUnprotectedAttrs() throws IOException { Asn1Object o = _seq.readObject(); if (o != null) { return (Asn1Set)((Asn1TaggedObject)o).getObject(BerTag.SET, false); }
282930313233343536373839
throws IOException { ByteArrayInputStream bIn = new ByteArrayInputStream(enc); Asn1InputStream aIn = new Asn1InputStream(bIn); Asn1ObjectIdentifier o = new Asn1ObjectIdentifier(oid); Asn1ObjectIdentifier encO = (Asn1ObjectIdentifier)aIn.readObject(); if (!o.equals(encO)) { fail("oid ID didn't match - got: " + o + " expected " + encO); }
56575859606162636465666768697071
private void valueCheck( String oid) throws IOException { Asn1ObjectIdentifier o = new Asn1ObjectIdentifier(oid); ByteArrayInputStream bIn = new ByteArrayInputStream(o.getEncoded()); Asn1InputStream aIn = new Asn1InputStream(bIn); o = (Asn1ObjectIdentifier)aIn.readObject(); if (!o.toString().equals(oid)) { fail("failed oid check for " + oid); } }
4041424344454647484950
ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DerSequenceGenerator seqGen = new DerSequenceGenerator(bOut); seqGen.addObject(new Asn1Integer(BigInteger.valueOf(0))); seqGen.addObject(new Asn1ObjectIdentifier("1.1")); seqGen.close(); assertTrue("basic DER writing test failed.", Arrays.equals(seqData, bOut.toByteArray())); }
5556575859606162636465
ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DerSequenceGenerator seqGen1 = new DerSequenceGenerator(bOut); seqGen1.addObject(new Asn1Integer(BigInteger.valueOf(0))); seqGen1.addObject(new Asn1ObjectIdentifier("1.1")); DerSequenceGenerator seqGen2 = new DerSequenceGenerator(seqGen1.getRawOutputStream()); seqGen2.addObject(new Asn1Integer(BigInteger.valueOf(1)));
7677787980818283848586
ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DerSequenceGenerator seqGen = new DerSequenceGenerator(bOut, 1, true); seqGen.addObject(new Asn1Integer(BigInteger.valueOf(0))); seqGen.addObject(new Asn1ObjectIdentifier("1.1")); seqGen.close(); assertTrue("explicit tag writing test failed.", Arrays.equals(expTagSeqData, bOut.toByteArray())); }
919293949596979899100101
ByteArrayOutputStream bOut = new ByteArrayOutputStream(); DerSequenceGenerator seqGen = new DerSequenceGenerator(bOut, 1, false); seqGen.addObject(new Asn1Integer(BigInteger.valueOf(0))); seqGen.addObject(new Asn1ObjectIdentifier("1.1")); seqGen.close(); assertTrue("implicit tag writing test failed.", Arrays.equals(implTagSeqData, bOut.toByteArray())); }