15850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann/* 25850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * Copyright (C) 2009 The Android Open Source Project 35850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * 45850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * Licensed under the Apache License, Version 2.0 (the "License"); 55850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * you may not use this file except in compliance with the License. 65850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * You may obtain a copy of the License at 75850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * 85850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * http://www.apache.org/licenses/LICENSE-2.0 95850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * 105850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * Unless required by applicable law or agreed to in writing, software 115850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * distributed under the License is distributed on an "AS IS" BASIS, 125850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * See the License for the specific language governing permissions and 145850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann * limitations under the License. 155850b60b2000dfdfd7c7bbe27d9ecee52d243933Jorg Pleumann */ 16adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 17f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilsonpackage tests.security; 18adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 19f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilsonimport java.security.KeyPair; 20f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilsonimport javax.crypto.Cipher; 21adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 22f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilsonpublic class CipherAsymmetricCryptHelper extends CipherHelper<KeyPair> { 23adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 24f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilson private static final String plainData = "some data to encrypt and decrypt test"; 25adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 26f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilson public CipherAsymmetricCryptHelper(String algorithmName) { 27f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilson super(algorithmName, plainData, Cipher.ENCRYPT_MODE, 28f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilson Cipher.DECRYPT_MODE); 29f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilson } 30f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes 31420ea38aecdef0f5895c5e82751ebabe26bc0bd5Kenny Root public void test(KeyPair keyPair) throws Exception { 32f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilson test(keyPair.getPrivate(), keyPair.getPublic()); 33f979bbd1277c77ca945ad981e7864fb4e9f6ae05Jesse Wilson } 34adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project} 35