Index: modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java =================================================================== --- modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java (revision 0) +++ modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java (revision 0) @@ -0,0 +1,38 @@ +package org.apache.harmony.security.tests.pkcs7; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import junit.framework.TestCase; + +import org.apache.harmony.security.pkcs7.ContentInfo; +import org.apache.harmony.security.pkcs7.SignedData; +import org.apache.harmony.security.pkcs7.SignerInfo; + +import tests.support.resource.Support_Resources; + +public class AuthenticatedAttributesTest extends TestCase { + private static final String tSTokenPath = "AuthenticatedAttributesTest"; + + public void testDecode() throws IOException { + InputStream in = Support_Resources.getResourceStream(tSTokenPath); + + try { + // AuthenticatedAttributes is not public and can be created + // only as a part of ContentInfo. + ContentInfo token = (ContentInfo) ContentInfo.ASN1.decode(in); + SignedData sigData = token.getSignedData(); + SignerInfo sigInfo = (SignerInfo) sigData.getSignerInfos().get(0); + List authAttributes = sigInfo.getAuthenticatedAttributes(); + assertNotNull("Decoded AuthenticatedAttributes is null", + authAttributes); + assertEquals("Decoded AuthenticatedAttributes size is incorrect", + 3, authAttributes.size()); + + } finally { + in.close(); + } + } +} +