List of usage examples for org.bouncycastle.asn1.cms CMSObjectIdentifiers signedAndEnvelopedData
ASN1ObjectIdentifier signedAndEnvelopedData
To view the source code for org.bouncycastle.asn1.cms CMSObjectIdentifiers signedAndEnvelopedData.
Click Source Link
From source file:mitm.common.security.cms.CMSContentTypeClassifier.java
License:Open Source License
/** * Returns the CMS content type of the provided sequence. * /*from ww w. j a va2s . co m*/ * See RFC3852 for content types * * @param sequenceParser * @return */ public static CMSContentType getContentType(ASN1SequenceParser sequenceParser) { CMSContentType contentType = CMSContentType.UNKNOWN; try { ContentInfoParser contentInfoParser = new ContentInfoParser(sequenceParser); DERObjectIdentifier derContentType = contentInfoParser.getContentType(); if (CMSObjectIdentifiers.data.equals(derContentType)) { contentType = CMSContentType.DATA; } else if (CMSObjectIdentifiers.signedData.equals(derContentType)) { contentType = CMSContentType.SIGNEDDATA; } else if (CMSObjectIdentifiers.envelopedData.equals(derContentType)) { contentType = CMSContentType.ENVELOPEDDATA; } else if (CMSObjectIdentifiers.signedAndEnvelopedData.equals(derContentType)) { contentType = CMSContentType.SIGNEDANDENVELOPEDDATA; } else if (CMSObjectIdentifiers.digestedData.equals(derContentType)) { contentType = CMSContentType.DIGESTEDDATA; } else if (CMSObjectIdentifiers.encryptedData.equals(derContentType)) { contentType = CMSContentType.ENCRYPTEDDATA; } else if (CMSObjectIdentifiers.compressedData.equals(derContentType)) { contentType = CMSContentType.COMPRESSEDDATA; } } catch (IOException e) { logger.error("IOException retrieving CMS content type", e); } return contentType; }