List of usage examples for org.bouncycastle.asn1.cms SignedData SignedData
private SignedData(ASN1Sequence seq)
From source file:org.jscep.pkcs7.SignedDataParser.java
License:Open Source License
/** * Parses the provided ASN1 object and extracts a degenerate SignedData * instance./*from ww w .j a v a 2 s .c o m*/ * * @param signedData the ASN1 object to parse. * @return a new degenerate SignedData instance. * @throws IOException if any I/O error occurs. */ public SignedData parse(ASN1Encodable signedData) throws IOException { LOGGER.entering(getClass().getName(), "parse", signedData); try { ContentInfo ci = ContentInfo.getInstance(signedData); ASN1Sequence seq = (ASN1Sequence) ci.getContent(); final SignedData sd = new SignedData(seq); LOGGER.exiting(getClass().getName(), "parse", sd); return sd; } catch (Exception e) { LOGGER.throwing(getClass().getName(), "parse", e); throw new IOException(e); } }
From source file:passwdmanager.hig.no.lds.DG_SOD.java
/** * Constructs a Security Object data structure. * // w ww . ja v a2s . c o m * @param in * some inputstream * @throws IOException * if something goes wrong */ public DG_SOD(InputStream in) throws IOException { BERTLVInputStream tlvIn = new BERTLVInputStream(in); if (tlvIn.readTag() != EF_SOD_TAG) throw new IOException("Wrong tag"); tlvIn.readLength(); ASN1InputStream asn1in = new ASN1InputStream(in); DERSequence seq = (DERSequence) asn1in.readObject(); DERObjectIdentifier objectIdentifier = (DERObjectIdentifier) seq.getObjectAt(0); if (!objectIdentifier.equals(SIGNED_DATA_OID)) { throw new IOException("Wrong OID: " + objectIdentifier.getId()); } DERTaggedObject o = (DERTaggedObject) seq.getObjectAt(1); /* TODO: where is this tagNo specified? */ // int tagNo = o.getTagNo(); DERSequence s2 = (DERSequence) o.getObject(); this.signedData = new SignedData(s2); }