You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/11/03 10:54:40 UTC
svn commit: r470741 - in
/incubator/harmony/enhanced/classlib/trunk/modules/security/src:
main/java/common/org/apache/harmony/security/pkcs7/
test/impl/java/org/apache/harmony/security/tests/pkcs7/ test/resources/
Author: smishura
Date: Fri Nov 3 01:54:39 2006
New Revision: 470741
URL: http://svn.apache.org/viewvc?view=rev&rev=470741
Log:
Apply patch for HARMONY-2041 ([classlib][security] o.a.h.s.pkcs7.AuthenticatedAttributes fails to decode)
Added:
incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java (with props)
incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/AuthenticatedAttributesTest.dat (with props)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/pkcs7/AuthenticatedAttributes.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/pkcs7/AuthenticatedAttributes.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/pkcs7/AuthenticatedAttributes.java?view=diff&rev=470741&r1=470740&r2=470741
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/pkcs7/AuthenticatedAttributes.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/pkcs7/AuthenticatedAttributes.java Fri Nov 3 01:54:39 2006
@@ -59,8 +59,9 @@
public static final ASN1SetOf ASN1 =
new ASN1SetOf(AttributeTypeAndValue.ASN1) {
public Object getDecodedObject(BerInputStream in) {
- Object[] values = (Object[]) in.content;
- return new AuthenticatedAttributes(in.getEncoded(), (List) values[0]);
+ return new AuthenticatedAttributes(in.getEncoded(),
+ (List) in.content);
}
};
-}
\ No newline at end of file
+}
+
Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java?view=auto&rev=470741
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java Fri Nov 3 01:54:39 2006
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.dat";
+
+ 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();
+ }
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/pkcs7/AuthenticatedAttributesTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/AuthenticatedAttributesTest.dat
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/AuthenticatedAttributesTest.dat?view=auto&rev=470741
==============================================================================
Binary file - no diff available.
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/resources/AuthenticatedAttributesTest.dat
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream