Home
last modified time | relevance | path

Searched refs:cipher (Results 1 – 12 of 12) sorted by relevance

/libcore/luni/src/test/java/libcore/javax/crypto/
DCipherInputStreamTest.java97 Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); in testAvailable() local
98 cipher.init(Cipher.DECRYPT_MODE, key, iv); in testAvailable()
100 InputStream cin = new CipherInputStream(in, cipher); in testAvailable()
106 Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); in testDecrypt_NullInput_Discarded() local
107 cipher.init(Cipher.DECRYPT_MODE, key, iv); in testDecrypt_NullInput_Discarded()
108 InputStream in = new CipherInputStream(new ByteArrayInputStream(aesCipherText), cipher); in testDecrypt_NullInput_Discarded()
119 Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); in testEncrypt() local
120 cipher.init(Cipher.ENCRYPT_MODE, key, iv); in testEncrypt()
122 new ByteArrayInputStream(plainText.getBytes("UTF-8")), cipher); in testEncrypt()
131 Cipher cipher = Cipher.getInstance("RC4"); in testEncrypt_RC4() local
[all …]
DCipherTest.java1396 Cipher cipher = Cipher.getInstance("RSA"); in assertCipherInitWithKeyUsage() local
1398 cipher.init(mode, certificate); in assertCipherInitWithKeyUsage()
1401 cipher.init(mode, certificate); in assertCipherInitWithKeyUsage()
/libcore/luni/src/test/java/org/apache/harmony/crypto/tests/javax/crypto/
DSealedObjectTest.java109 Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); in testSealedObject1() local
110 cipher.init(Cipher.ENCRYPT_MODE, key, ips); in testSealedObject1()
112 SealedObject so = new SealedObject(secret, cipher); in testSealedObject1()
114 cipher = Cipher.getInstance("DES/CBC/NoPadding"); in testSealedObject1()
115 cipher.init(Cipher.ENCRYPT_MODE, key, ips); in testSealedObject1()
118 new SealedObject(secret, cipher); in testSealedObject1()
138 Cipher cipher = new NullCipher(); in testSealedObject2() local
139 SealedObject so1 = new SealedObject(secret, cipher); in testSealedObject2()
144 .getObject(cipher)); in testSealedObject2()
160 Cipher cipher = Cipher.getInstance(algorithm); in testGetAlgorithm() local
[all …]
DCipherTest.java92 Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); in test_getInstanceLjava_lang_String() local
93 assertNotNull("Received a null Cipher instance", cipher); in test_getInstanceLjava_lang_String()
114 Cipher cipher = Cipher.getInstance("DES", providers[i].getName()); in test_getInstanceLjava_lang_StringLjava_lang_String() local
115 assertNotNull("Cipher.getInstance() returned a null value", cipher); in test_getInstanceLjava_lang_StringLjava_lang_String()
118 cipher = Cipher.getInstance("DoBeDoBeDo", providers[i]); in test_getInstanceLjava_lang_StringLjava_lang_String()
148 Cipher cipher = Cipher.getInstance("DES", providers[i]); in test_getInstanceLjava_lang_StringLjava_security_Provider() local
149 assertNotNull("Cipher.getInstance() returned a null value", cipher); in test_getInstanceLjava_lang_StringLjava_security_Provider()
176 Cipher cipher = Cipher.getInstance("AES", provider.getName()); in test_getProvider() local
177 Provider cipherProvider = cipher.getProvider(); in test_getProvider()
190 Cipher cipher = Cipher.getInstance(algorithm); in test_getAlgorithm() local
[all …]
/libcore/support/src/test/java/tests/security/
DCipherHelper.java43 Cipher cipher = null; in test() local
45 cipher = Cipher.getInstance(algorithmName); in test()
52 cipher.init(mode1, encryptKey); in test()
57 byte[] encrypted = crypt(cipher, plainData.getBytes()); in test()
60 cipher.init(mode2, decryptKey); in test()
65 byte[] decrypted = crypt(cipher, encrypted); in test()
73 public byte[] crypt(Cipher cipher, byte[] input) { in crypt() argument
75 return cipher.doFinal(input); in crypt()
DAlgorithmParameterAsymmetricHelper.java56 Cipher cipher = null; in test() local
58 cipher = Cipher.getInstance(algorithmName); in test()
66 cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic(), parameters); in test()
75 bs = cipher.doFinal(plainData.getBytes()); in test()
83 cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate(), parameters); in test()
92 decrypted = cipher.doFinal(bs); in test()
DAlgorithmParameterSymmetricHelper.java64 Cipher cipher = null; in test() local
71 cipher = Cipher.getInstance(transformation); in test()
79 cipher.init(Cipher.ENCRYPT_MODE, key, parameters); in test()
88 bs = cipher.doFinal(plainData.getBytes()); in test()
96 cipher.init(Cipher.DECRYPT_MODE, key, parameters); in test()
105 decrypted = cipher.doFinal(bs); in test()
/libcore/luni/src/main/java/javax/crypto/
DCipherOutputStream.java37 private final Cipher cipher; field in CipherOutputStream
50 cipher = c; in CipherOutputStream()
95 byte[] result = cipher.update(b, off, len); in write()
126 if (cipher != null) { in close()
127 result = cipher.doFinal(); in close()
DEncryptedPrivateKeyInfo.java240 public PKCS8EncodedKeySpec getKeySpec(Cipher cipher) in getKeySpec() argument
242 if (cipher == null) { in getKeySpec()
246 byte[] decryptedData = cipher.doFinal(encryptedData); in getKeySpec()
284 Cipher cipher = Cipher.getInstance(algName); in getKeySpec() local
286 cipher.init(Cipher.DECRYPT_MODE, decryptKey); in getKeySpec()
288 cipher.init(Cipher.DECRYPT_MODE, decryptKey, algParameters); in getKeySpec()
290 byte[] decryptedData = cipher.doFinal(encryptedData); in getKeySpec()
343 Cipher cipher = Cipher.getInstance(algName, providerName); in getKeySpec() local
345 cipher.init(Cipher.DECRYPT_MODE, decryptKey); in getKeySpec()
347 cipher.init(Cipher.DECRYPT_MODE, decryptKey, algParameters); in getKeySpec()
[all …]
DCipherInputStream.java38 private final Cipher cipher; field in CipherInputStream
60 this.cipher = c; in CipherInputStream()
95 int outputSize = cipher.getOutputSize(inputBuffer.length); in fillBuffer()
102 outputLength = cipher.doFinal(outputBuffer, 0); in fillBuffer()
110 outputLength = cipher.update(inputBuffer, 0, byteCount, outputBuffer, 0); in fillBuffer()
190 cipher.doFinal(); in close()
DSealedObject.java173 Cipher cipher = Cipher.getInstance(sealAlg); in getObject() local
177 cipher.init(Cipher.DECRYPT_MODE, key, params); in getObject()
179 cipher.init(Cipher.DECRYPT_MODE, key); in getObject()
181 byte[] serialized = cipher.doFinal(encryptedContent); in getObject()
261 Cipher cipher = Cipher.getInstance(sealAlg, provider); in getObject() local
265 cipher.init(Cipher.DECRYPT_MODE, key, params); in getObject()
267 cipher.init(Cipher.DECRYPT_MODE, key); in getObject()
269 byte[] serialized = cipher.doFinal(encryptedContent); in getObject()
/libcore/support/src/test/java/libcore/java/security/
DStandardNames.java1127 public static Set<String> getModesForCipher(String cipher) { in getModesForCipher() argument
1128 return CIPHER_MODES.get(cipher); in getModesForCipher()
1134 public static Set<String> getPaddingsForCipher(String cipher) { in getPaddingsForCipher() argument
1135 return CIPHER_PADDINGS.get(cipher); in getPaddingsForCipher()