1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.xml.security.test.interop; 20 21 22 import org.apache.xml.security.utils.resolver.ResourceResolverSpi; 23 24 25 /** 26 * This test is to ensure interoperability with the examples provided by Blake Dournaee 27 * from RSA Security using Cert-J 2.01. These test vectors are located in the directory 28 * <CODE>data/com/rsasecurity/bdournaee/</CODE>. 29 * 30 * @author $Author: coheigea $ 31 * @see <A HREF="http://www.rsasecurity.com/products/bsafe/certj.html">RSA BSAFE Cert-J</A> 32 */ 33 public class RSASecurityTest extends InteropTestBase { 34 35 /** {@link org.apache.commons.logging} logging facility */ 36 static org.apache.commons.logging.Log log = 37 org.apache.commons.logging.LogFactory.getLog(RSASecurityTest.class.getName()); 38 39 /** Field blakesDir */ 40 static String blakesDir = 41 "src/test/resources/com/rsasecurity/bdournaee/"; 42 43 static { 44 String basedir = System.getProperty("basedir"); 45 if(basedir != null && !"".equals(basedir)) { 46 blakesDir = basedir + "/" + blakesDir; 47 } org.apache.xml.security.Init.init()48 org.apache.xml.security.Init.init(); 49 } 50 51 /** 52 * Constructor RSASecurityTest 53 */ RSASecurityTest()54 public RSASecurityTest() { 55 super(); 56 } 57 58 @org.junit.Test test_enveloping()59 public void test_enveloping() throws Exception { 60 61 String filename = blakesDir + "certj201_enveloping.xml"; 62 boolean followManifests = false; 63 ResourceResolverSpi resolver = null; 64 boolean verify = this.verify(filename, resolver, followManifests); 65 66 if (!verify) { 67 log.error("Verification failed for " + filename); 68 } 69 70 assertTrue(filename, verify); 71 } 72 73 @org.junit.Test test_enveloped()74 public void test_enveloped() throws Exception { 75 76 String filename = blakesDir + "certj201_enveloped.xml"; 77 boolean followManifests = false; 78 ResourceResolverSpi resolver = null; 79 boolean verify = this.verify(filename, resolver, followManifests); 80 81 if (!verify) { 82 log.error("Verification failed for " + filename); 83 } 84 85 assertTrue(filename, verify); 86 } 87 88 } 89