Search in sources :

Example 81 with ContentInfo

use of com.github.zhenwei.pkix.util.asn1.cms.ContentInfo in project vnfsdk-validation by onap.

the class SignatureFactoryTest method shouldCreateContentInfoWithProperContentForDecodedPKCS7.

@Test
public void shouldCreateContentInfoWithProperContentForDecodedPKCS7() throws IOException, CmsSignatureLoadingException {
    // given
    InputStream signatureAsStream = loadFileFromResources();
    // when
    ContentInfo contentInfo = signatureFactory.createSignature(signatureAsStream.readAllBytes());
    // then
    final String contentInfoSignature = getContentInfoSignatureAsPem(contentInfo);
    assertThat(testPkcs7Signature).contains(contentInfoSignature);
}
Also used : ContentInfo(org.bouncycastle.asn1.cms.ContentInfo) InputStream(java.io.InputStream) Test(org.junit.Test)

Aggregations

ContentInfo (org.bouncycastle.asn1.cms.ContentInfo)60 IOException (java.io.IOException)28 CMSSignedData (org.bouncycastle.cms.CMSSignedData)22 ContentInfo (com.github.zhenwei.pkix.util.asn1.cms.ContentInfo)18 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)15 OutputStream (java.io.OutputStream)12 X509Certificate (java.security.cert.X509Certificate)12 ArrayList (java.util.ArrayList)12 SignedData (org.bouncycastle.asn1.cms.SignedData)12 Iterator (java.util.Iterator)11 ASN1Set (org.bouncycastle.asn1.ASN1Set)11 ASN1EncodableVector (com.github.zhenwei.core.asn1.ASN1EncodableVector)10 ASN1Set (com.github.zhenwei.core.asn1.ASN1Set)10 ASN1OctetString (com.github.zhenwei.core.asn1.ASN1OctetString)9 ByteArrayInputStream (java.io.ByteArrayInputStream)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)9 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)9 ASN1InputStream (org.bouncycastle.asn1.ASN1InputStream)9 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)9 DERSet (org.bouncycastle.asn1.DERSet)9