mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-23 11:27:57 +01:00
Add ImplementationFactory.getSessionKeyDataDecryptorFactory() and impls
This commit is contained in:
parent
8dfabf1842
commit
9e403c1124
3 changed files with 22 additions and 0 deletions
|
@ -113,6 +113,11 @@ public class BcImplementationFactory extends ImplementationFactory {
|
||||||
return new BcPublicKeyDataDecryptorFactory(privateKey);
|
return new BcPublicKeyDataDecryptorFactory(privateKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SessionKeyDataDecryptorFactory getSessionKeyDataDecryptorFactory(PGPSessionKey sessionKey) {
|
||||||
|
return new BcSessionKeyDataDecryptorFactory(sessionKey);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PublicKeyKeyEncryptionMethodGenerator getPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key) {
|
public PublicKeyKeyEncryptionMethodGenerator getPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key) {
|
||||||
return new BcPublicKeyKeyEncryptionMethodGenerator(key);
|
return new BcPublicKeyKeyEncryptionMethodGenerator(key);
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.pgpainless.algorithm.HashAlgorithm;
|
||||||
import org.pgpainless.algorithm.PublicKeyAlgorithm;
|
import org.pgpainless.algorithm.PublicKeyAlgorithm;
|
||||||
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
|
import org.pgpainless.algorithm.SymmetricKeyAlgorithm;
|
||||||
import org.pgpainless.util.Passphrase;
|
import org.pgpainless.util.Passphrase;
|
||||||
|
import org.pgpainless.util.SessionKey;
|
||||||
|
|
||||||
public abstract class ImplementationFactory {
|
public abstract class ImplementationFactory {
|
||||||
|
|
||||||
|
@ -91,6 +92,16 @@ public abstract class ImplementationFactory {
|
||||||
|
|
||||||
public abstract PublicKeyDataDecryptorFactory getPublicKeyDataDecryptorFactory(PGPPrivateKey privateKey);
|
public abstract PublicKeyDataDecryptorFactory getPublicKeyDataDecryptorFactory(PGPPrivateKey privateKey);
|
||||||
|
|
||||||
|
public SessionKeyDataDecryptorFactory getSessionKeyDataDecryptorFactory(SessionKey sessionKey) {
|
||||||
|
PGPSessionKey pgpSessionKey = new PGPSessionKey(
|
||||||
|
sessionKey.getAlgorithm().getAlgorithmId(),
|
||||||
|
sessionKey.getKey()
|
||||||
|
);
|
||||||
|
return getSessionKeyDataDecryptorFactory(pgpSessionKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract SessionKeyDataDecryptorFactory getSessionKeyDataDecryptorFactory(PGPSessionKey sessionKey);
|
||||||
|
|
||||||
public abstract PublicKeyKeyEncryptionMethodGenerator getPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key);
|
public abstract PublicKeyKeyEncryptionMethodGenerator getPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key);
|
||||||
|
|
||||||
public abstract PBEKeyEncryptionMethodGenerator getPBEKeyEncryptionMethodGenerator(Passphrase passphrase);
|
public abstract PBEKeyEncryptionMethodGenerator getPBEKeyEncryptionMethodGenerator(Passphrase passphrase);
|
||||||
|
|
|
@ -103,6 +103,12 @@ public class JceImplementationFactory extends ImplementationFactory {
|
||||||
.build(privateKey);
|
.build(privateKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SessionKeyDataDecryptorFactory getSessionKeyDataDecryptorFactory(PGPSessionKey sessionKey) {
|
||||||
|
return new JceSessionKeyDataDecryptorFactoryBuilder()
|
||||||
|
.build(sessionKey);
|
||||||
|
}
|
||||||
|
|
||||||
public PublicKeyKeyEncryptionMethodGenerator getPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key) {
|
public PublicKeyKeyEncryptionMethodGenerator getPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key) {
|
||||||
return new JcePublicKeyKeyEncryptionMethodGenerator(key)
|
return new JcePublicKeyKeyEncryptionMethodGenerator(key)
|
||||||
.setProvider(ProviderFactory.getProvider());
|
.setProvider(ProviderFactory.getProvider());
|
||||||
|
|
Loading…
Reference in a new issue