1/*2 * Copyright 2013 The Apache Software Foundation.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package org.apache.juddi.v3.client.cryptor;
1718import org.apache.juddi.v3.client.config.UDDIClerk;
19import org.apache.juddi.v3.client.config.UDDIClient;
20import org.apache.juddi.v3.client.cryptor.CryptorFactory;
21import org.junit.Assert;
22import org.junit.Test;
2324/**25 *26 * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>27 */28publicclassCryptoConfigTest {
2930 @Test()
31publicvoid EncryptedCredentialsAES128Test() throws Exception {
32 UDDIClient clerkManager = new UDDIClient("META-INF/uddi3-enc-aes128.xml");
33// Now you create a reference to the UDDI API34 UDDIClerk c = clerkManager.getClerk("default");
35 UDDIClerk c2 = clerkManager.getClerk("medroot");
36 Assert.assertNotSame(c.getPassword(), c2.getPassword());
37 Assert.assertEquals("root", CryptorFactory.getCryptor(c.getCryptoProvider()).decrypt(c.getRawPassword()));
38 Assert.assertEquals("root", c.getPassword());
3940 Assert.assertEquals("password", CryptorFactory.getCryptor(c2.getCryptoProvider()).decrypt(c2.getRawPassword()));
41 Assert.assertEquals("password", c2.getPassword());
424344 }
45 }