public interface CryptoService
The service provides crypto related functionality such as signing and decrypting.
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decrypt(byte[] ciphertext,
String algorithm,
String javaSecurityAPIProvider)
Computes and returns the cleartext of the given ciphertext.
|
byte[] |
decrypt(byte[] ciphertext,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
Computes and returns the cleartext of the given ciphertext comes from an external entity.
|
byte[] |
encrypt(byte[] cleartext,
String algorithm,
String javaSecurityAPIProvider)
Computes and returns the ciphertext of the given cleartext.
|
byte[] |
encrypt(byte[] cleartext,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
Computes and returns the ciphertext of the given cleartext, using asymmetric cryptography.
|
Certificate |
getCertificate(CryptoContext cryptoContext)
Returns the
Certificate based on the given CryptoContext |
byte[] |
sign(byte[] data,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
Computes and returns the signature of given data.
|
boolean |
verifySignature(byte[] data,
byte[] signature,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
Verifies whether given signature of the given data was generated by a trusted external party.
|
byte[] encrypt(byte[] cleartext,
String algorithm,
String javaSecurityAPIProvider)
throws CryptoException
The encrypted data is only for internal usage (e.g. encrypting passwords before persisting), therefore the ciphertext is NOT supposed to be shared with other systems.
cleartext - The cleartext to be encrypted.algorithm - The encryption / decryption algorithmjavaSecurityAPIProvider - The Java Security API provider.CryptoException - If something unexpected happens during the encryption operation.byte[] decrypt(byte[] ciphertext,
String algorithm,
String javaSecurityAPIProvider)
throws CryptoException
The input ciphertext should be a ciphertext which was generated from
encrypt(byte[], String, String) method.
ciphertext - The ciphertext to be decrypted.algorithm - The signature + hashing algorithm to be used in signing.javaSecurityAPIProvider - The Java Security API provider.CryptoException - If something unexpected happens during the decryption operation.byte[] sign(byte[] data,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
throws CryptoException
data - The content which the signature should be generated against.algorithm - The signature + hashing algorithm to be used in signing.javaSecurityAPIProvider - The Java Security API provider.cryptoContext - The context information which is needed to discover the private key.CryptoException - If something unexpected happens during the signing operation.byte[] decrypt(byte[] ciphertext,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
throws CryptoException
ciphertext - The content which the signature should be generated against.algorithm - The signature + hashing algorithm to be used in signing.javaSecurityAPIProvider - The Java Security API provider.cryptoContext - The context information which is needed to discover the private key.CryptoException - If something unexpected happens during the decryption operation.byte[] encrypt(byte[] cleartext,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
throws CryptoException
cleartext - The cleartext to be encrypted.algorithm - The signature + hashing algorithm to be used in signing.javaSecurityAPIProvider - The Java Security API provider.cryptoContext - The context information which is needed to discover the public key of the external entity.CryptoException - If something unexpected happens during the encryption operation.boolean verifySignature(byte[] data,
byte[] signature,
String algorithm,
String javaSecurityAPIProvider,
CryptoContext cryptoContext)
throws CryptoException
data - The data which was the signature generated on.signature - The signature bytes of data.algorithm - The signature + hashing algorithm to be used in signing.javaSecurityAPIProvider - The Java Security API provider.cryptoContext - The context information which is needed to discover the public key of the external entity.CryptoException - If something unexpected happens during the signature verification.Certificate getCertificate(CryptoContext cryptoContext) throws CryptoException
Certificate based on the given CryptoContextcryptoContext - The context information which is used to discover the public key of the external entity.Certificate relates with the given context.CryptoException - If something unexpected happens during certificate discovery.Copyright © 2018 WSO2. All rights reserved.