/******************************************************************************* * ============LICENSE_START==================================================== * * org.onap.aaf * * =========================================================================== * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. * * =========================================================================== * * Licensed 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. * * ============LICENSE_END==================================================== * * * * ******************************************************************************/ package org.onap.aaf.cadi.test; import static org.junit.Assert.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Field; import java.nio.file.Files; import java.nio.file.Paths; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.crypto.SecretKey; import org.junit.Test; import org.onap.aaf.cadi.AES; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.Symm; import org.junit.Before; public class JU_AES { private AES aes; private ByteArrayInputStream baisEncrypt; private ByteArrayInputStream baisDecrypt; private ByteArrayOutputStream baosEncrypt; private ByteArrayOutputStream baosDecrypt; @Before public void setup() throws Exception { byte[] keyBytes = new byte[AES.AES_KEY_SIZE/8]; char[] codeset = Symm.base64.codeset; int offset = (Math.abs(codeset[0])+47)%(codeset.length-keyBytes.length); for(int i=0;i