diff options
author | Roberto Tyley <roberto.tyley@gmail.com> | 2014-07-15 01:38:01 +0400 |
---|---|---|
committer | Roberto Tyley <roberto.tyley@gmail.com> | 2014-07-26 11:23:17 +0400 |
commit | 7cb752aaf746dc0b473afeb9e892b7fbc12666c5 (patch) | |
tree | cc4f91ddc18332b5adbe82e3fcb040d976c90105 /pkix/src/main/java/org/bouncycastle/operator/bc/BcAsymmetricKeyUnwrapper.java | |
parent | 551830f8ea5177042af2c7dd1fc90888bc67387d (diff) |
Execute become-spongy.sh
https://github.com/rtyley/spongycastle/blob/3040af/become-spongy.sh
Diffstat (limited to 'pkix/src/main/java/org/bouncycastle/operator/bc/BcAsymmetricKeyUnwrapper.java')
-rw-r--r-- | pkix/src/main/java/org/bouncycastle/operator/bc/BcAsymmetricKeyUnwrapper.java | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/pkix/src/main/java/org/bouncycastle/operator/bc/BcAsymmetricKeyUnwrapper.java b/pkix/src/main/java/org/bouncycastle/operator/bc/BcAsymmetricKeyUnwrapper.java deleted file mode 100644 index 2bf5c2d7..00000000 --- a/pkix/src/main/java/org/bouncycastle/operator/bc/BcAsymmetricKeyUnwrapper.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.bouncycastle.operator.bc; - -import org.bouncycastle.asn1.ASN1ObjectIdentifier; -import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; -import org.bouncycastle.asn1.x509.AlgorithmIdentifier; -import org.bouncycastle.crypto.AsymmetricBlockCipher; -import org.bouncycastle.crypto.InvalidCipherTextException; -import org.bouncycastle.crypto.params.AsymmetricKeyParameter; -import org.bouncycastle.operator.AsymmetricKeyUnwrapper; -import org.bouncycastle.operator.GenericKey; -import org.bouncycastle.operator.OperatorException; - -public abstract class BcAsymmetricKeyUnwrapper - extends AsymmetricKeyUnwrapper -{ - private AsymmetricKeyParameter privateKey; - - public BcAsymmetricKeyUnwrapper(AlgorithmIdentifier encAlgId, AsymmetricKeyParameter privateKey) - { - super(encAlgId); - - this.privateKey = privateKey; - } - - public GenericKey generateUnwrappedKey(AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedKey) - throws OperatorException - { - AsymmetricBlockCipher keyCipher = createAsymmetricUnwrapper(this.getAlgorithmIdentifier().getAlgorithm()); - - keyCipher.init(false, privateKey); - try - { - byte[] key = keyCipher.processBlock(encryptedKey, 0, encryptedKey.length); - - if (encryptedKeyAlgorithm.getAlgorithm().equals(PKCSObjectIdentifiers.des_EDE3_CBC)) - { - return new GenericKey(encryptedKeyAlgorithm, key); - } - else - { - return new GenericKey(encryptedKeyAlgorithm, key); - } - } - catch (InvalidCipherTextException e) - { - throw new OperatorException("unable to recover secret key: " + e.getMessage(), e); - } - } - - protected abstract AsymmetricBlockCipher createAsymmetricUnwrapper(ASN1ObjectIdentifier algorithm); -} |