|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface EncryptionProvider
Abstracts out the provision of encryption to the trusted app service. For two applications to communicate effectively, they must use the same encryption provider. In our experience, even using the same algorithms but different providers will cause issues.
This abstraction is mostly used in unit testing, to avoid having to bring up a fully-fledged crypto provider
| Method Summary | |
|---|---|
EncryptedCertificate |
createEncryptedCertificate(java.lang.String userName,
java.security.PrivateKey privateKey,
java.lang.String appId)
Create a new encrypted certificate for transmission to another application |
ApplicationCertificate |
decodeEncryptedCertificate(EncryptedCertificate encCert,
java.security.PublicKey publicKey,
java.lang.String appId)
Decode an encrypted certificate to retrieve its ApplicationCertificate |
java.security.KeyPair |
generateNewKeyPair()
Generate a new public/private key pair for an application |
java.lang.String |
generateUID()
Generate a unique 32 character String ID. |
Application |
getApplicationCertificate(java.lang.String baseUrl)
Retrieve the application certificate from some other application, over HTTP. |
java.security.PrivateKey |
toPrivateKey(byte[] encodedForm)
Convert an encoded private key into a PrivateKey instance |
java.security.PublicKey |
toPublicKey(byte[] encodedForm)
Convert an encoded public key into a PublicKey instance |
| Method Detail |
|---|
Application getApplicationCertificate(java.lang.String baseUrl)
throws ApplicationRetriever.RetrievalException
${baseUrl}/admin/appTrustCertificate. TODO: document the exception policy
baseUrl - the base URL of the application to be queried
ApplicationRetriever.RetrievalException - if there are problems with the certificate retrieved from the remote server or the server cannot be
contacted
java.lang.RuntimeException - if there are problems retrieving the certificate from the remote server
java.security.KeyPair generateNewKeyPair()
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException - if the algorithm to generate the keypair is not available
java.security.NoSuchProviderException - if no appropriate cryptographic provider is availablejava.lang.String generateUID()
ApplicationCertificate decodeEncryptedCertificate(EncryptedCertificate encCert,
java.security.PublicKey publicKey,
java.lang.String appId)
throws InvalidCertificateException
encCert - the encrypted certificate of the applicationpublicKey - the application's public keyappId - the application's ID
InvalidCertificateException - if the certificate was malformed, or could not be decrypted
EncryptedCertificate createEncryptedCertificate(java.lang.String userName,
java.security.PrivateKey privateKey,
java.lang.String appId)
userName - the username to certifyprivateKey - the private key of this applicationappId - the ID of this application
java.security.PrivateKey toPrivateKey(byte[] encodedForm)
throws java.security.NoSuchAlgorithmException,
java.security.spec.InvalidKeySpecException,
java.security.NoSuchProviderException
encodedForm - the byte-array representation of the key
java.security.NoSuchAlgorithmException - if the algorithm to generate the keypair is not available
java.security.NoSuchProviderException - if no appropriate cryptographic provider is available
java.security.spec.InvalidKeySpecException - if the encoded form does not contain a valid key
java.security.PublicKey toPublicKey(byte[] encodedForm)
throws java.security.NoSuchAlgorithmException,
java.security.spec.InvalidKeySpecException,
java.security.NoSuchProviderException
encodedForm - the byte-array representation of the key
java.security.NoSuchAlgorithmException - if the algorithm to generate the keypair is not available
java.security.NoSuchProviderException - if no appropriate cryptographic provider is available
java.security.spec.InvalidKeySpecException - if the encoded form does not contain a valid key
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||