public interface IAsymmetricCipherSuite extends ICipherSuite
| Modifier and Type | Method and Description |
|---|---|
org.bouncycastle.cert.X509AttributeCertificateHolder |
createAttributeCert(X509Certificate clientCert,
Date notBefore,
Date notAfter,
URL ocspUrl,
PrivateKey caPrivKey,
X509Certificate caCert,
BigInteger serialNumber,
String policyOid,
URL policyUrl,
String attributeId,
String attributeValue)
Generate an Attribute Certificate.
|
X509Certificate |
createCert(org.bouncycastle.asn1.x509.GeneralName[] subjectAlternativeNames,
org.bouncycastle.pkcs.PKCS10CertificationRequest csr,
org.bouncycastle.asn1.x500.X500Name principal,
Date notBefore,
Date notAfter,
URL ocspUrl,
PrivateKey caPrivKey,
X509Certificate caCert,
BigInteger serialNumber,
String policyOid,
URL policyUrl,
CertType certificateType)
Generate an end user certificate from a CSR.
|
X509Certificate |
createCert(org.bouncycastle.asn1.x509.GeneralName[] subjectAlternativeNames,
PublicKey pubKey,
org.bouncycastle.asn1.x500.X500Name principal,
Date notBefore,
Date notAfter,
URL ocspUrl,
PrivateKey caPrivKey,
X509Certificate caCert,
BigInteger serialNumber,
String policyOid,
URL policyUrl,
CertType certificateType)
Generate an end user certificate.
|
X509Certificate |
createCert(String subjectRfc822AlternativeName,
PublicKey pubKey,
org.bouncycastle.asn1.x500.X500Name principal,
Date notBefore,
Date notAfter,
URL ocspUrl,
PrivateKey caPrivKey,
X509Certificate caCert,
BigInteger serialNumber,
String policyOid,
URL policyUrl,
CertType certificateType)
Generate an end user certificate.
|
org.bouncycastle.pkcs.PKCS10CertificationRequest |
createCSR(org.bouncycastle.asn1.x500.X500Name subject,
PublicKey publicKey,
PrivateKey privateKey,
org.bouncycastle.asn1.x509.GeneralName[] subjectAlternateNames) |
X509Certificate |
createMasterCert(PublicKey pubKey,
PrivateKey privKey,
org.bouncycastle.asn1.x500.X500Name principal,
Date notBefore,
Date notAfter,
URL ocspUrl,
BigInteger serialNumber)
Generate a Master, self signed certificate.
|
X509Certificate |
createSelfSignedCert(KeyPair keyPair,
org.bouncycastle.asn1.x500.X500Name subject,
int validDays)
Create a self signed certificate for the given principal.
|
KeyPair |
generateKeyPair() |
AsymmetricCipher |
getId()
Get the unique ID for this cipher suite.
|
int |
getKeySize(PrivateKey key) |
int |
getKeySize(PublicKey key) |
String |
getSignatureAlgorithm()
Return the name of the SignatureAlgorithm used by this CipherSuite.
|
PrivateKey |
privateKeyFromDER(String der) |
String |
privateKeyToDER(PrivateKey key) |
PublicKey |
publicKeyFromDER(String der) |
String |
publicKeyToDER(PublicKey key) |
byte[] |
sign(byte[] data,
PrivateKey privateKey)
Sign the given data.
|
String |
sign(String data,
PrivateKey privateKey)
Sign the given data and return a base64 encoded string of the signature.
|
SecretKey |
unwrap(byte[] cipherText,
PrivateKey userPrivateKey,
ISymmetricCipherSuite symmetricCipherSuite)
Unwrap the given encrypted SecretKey
|
void |
validateKey(KeyPair keyPair)
Validate the given KeyPair and throw an exception if it is not suitable for
use with this CipherSuite.
|
void |
validateKey(PrivateKey key)
Validate the given key and throw an exception if it is not suitable for
use with this CipherSuite.
|
void |
validateKey(PublicKey key)
Validate the given key and throw an exception if it is not suitable for
use with this CipherSuite.
|
void |
verifySignature(byte[] encodedSignature,
byte[] data,
Certificate certificate) |
void |
verifySignature(byte[] encodedSignature,
byte[] data,
PublicKey publicKey) |
byte[] |
wrap(SecretKey key,
PublicKey userKey)
Wrap the given symmetric key by encrypting with the given user's public key.
|
getCipher, getKeyAlgorithm, getKeySizeAsymmetricCipher getId()
void validateKey(KeyPair keyPair) throws InvalidKeyException
keyPair - A KeyPair to validate.InvalidKeyException - If the given KeyPair is incompatible with the
current CipherSuite.void validateKey(PrivateKey key) throws InvalidKeyException
key - A key to validate.InvalidKeyException - If the given KeyPair is incompatible with the
current CipherSuite.void validateKey(PublicKey key) throws InvalidKeyException
key - A key to validate.InvalidKeyException - If the given KeyPair is incompatible with the
current CipherSuite.String getSignatureAlgorithm()
org.bouncycastle.pkcs.PKCS10CertificationRequest createCSR(org.bouncycastle.asn1.x500.X500Name subject,
PublicKey publicKey,
PrivateKey privateKey,
org.bouncycastle.asn1.x509.GeneralName[] subjectAlternateNames)
throws org.bouncycastle.operator.OperatorCreationException,
IOException
org.bouncycastle.operator.OperatorCreationExceptionIOExceptionKeyPair generateKeyPair()
X509Certificate createSelfSignedCert(KeyPair keyPair, org.bouncycastle.asn1.x500.X500Name subject, int validDays) throws InvalidKeyException
keyPair - The public key to be associate with the certificate and the private key to
sign the certificate with.subject - Subject principal.validDays - Number of days from now for which the certificate will be valid.InvalidKeyException - If the given keys are incompatible with this CipherSuite.byte[] sign(byte[] data,
PrivateKey privateKey)
throws InvalidKeyException
data - Data to be signedprivateKey - Signing key.InvalidKeyException - If the given keys are incompatible with this CipherSuite.String sign(String data, PrivateKey privateKey) throws InvalidKeyException
data - Data to be signedprivateKey - Private signing key.InvalidKeyException - If the given keys are incompatible with this CipherSuite.void verifySignature(byte[] encodedSignature,
byte[] data,
Certificate certificate)
throws SignatureVerificationException
SignatureVerificationExceptionvoid verifySignature(byte[] encodedSignature,
byte[] data,
PublicKey publicKey)
throws SignatureVerificationException
SignatureVerificationExceptionX509Certificate createMasterCert(PublicKey pubKey, PrivateKey privKey, org.bouncycastle.asn1.x500.X500Name principal, Date notBefore, Date notAfter, URL ocspUrl, BigInteger serialNumber)
pubKey - Public key for principal.privKey - Private key for principal, used to sign the certificate.principal - The subject of the certificate.notBefore - Validity start date.notAfter - Validity end date.ocspUrl - If non-null then this is added as the OCSP URL for the certificate.serialNumber - Certificate serial number, should be unique for this CA.X509Certificate createCert(String subjectRfc822AlternativeName, PublicKey pubKey, org.bouncycastle.asn1.x500.X500Name principal, Date notBefore, Date notAfter, URL ocspUrl, PrivateKey caPrivKey, X509Certificate caCert, BigInteger serialNumber, String policyOid, URL policyUrl, CertType certificateType) throws InvalidKeyException
subjectRfc822AlternativeName - If non-null then this is added as the subject's email addresspubKey - Public key for principal.principal - The subject of the certificate.notBefore - Validity start date.notAfter - Validity end date.ocspUrl - If non-null then this is added as the OCSP URL for the certificate.caPrivKey - Private key for the CA, used to sign the certificate.caCert - The certificate relating to the caPrivKeyserialNumber - Certificate serial number, should be unique for this CA.policyOid - Optional OID for certificate policy, needs policyUrl as well.policyUrl - Optional URL for certificate policy, needs policyOid as well.certificateType - Type of certificate required, one of
UserEncryption, UserSigning or ServerInvalidKeyException - If the given keys are incompatible with this CipherSuite.X509Certificate createCert(org.bouncycastle.asn1.x509.GeneralName[] subjectAlternativeNames, PublicKey pubKey, org.bouncycastle.asn1.x500.X500Name principal, Date notBefore, Date notAfter, URL ocspUrl, PrivateKey caPrivKey, X509Certificate caCert, BigInteger serialNumber, String policyOid, URL policyUrl, CertType certificateType) throws InvalidKeyException
subjectAlternativeNames - If non-null then this array of GeneralName is added as the subject's alternative names.pubKey - Public key for principal.principal - The subject of the certificate.notBefore - Validity start date.notAfter - Validity end date.ocspUrl - If non-null then this is added as the OCSP URL for the certificate.caPrivKey - Private key for the CA, used to sign the certificate.caCert - The certificate relating to the caPrivKeyserialNumber - Certificate serial number, should be unique for this CA.policyOid - Optional OID for certificate policy, needs policyUrl as well.policyUrl - Optional URL for certificate policy, needs policyOid as well.certificateType - Type of certificate required, one of
UserEncryption, UserSigning or ServerInvalidKeyException - If the given keys are incompatible with this CipherSuite.X509Certificate createCert(org.bouncycastle.asn1.x509.GeneralName[] subjectAlternativeNames, org.bouncycastle.pkcs.PKCS10CertificationRequest csr, org.bouncycastle.asn1.x500.X500Name principal, Date notBefore, Date notAfter, URL ocspUrl, PrivateKey caPrivKey, X509Certificate caCert, BigInteger serialNumber, String policyOid, URL policyUrl, CertType certificateType) throws InvalidKeyException, SignatureVerificationException
subjectAlternativeNames - If non-null then this array of GeneralName is added as the subject's alternative names.csr - A Certificate Signing Requestprincipal - The subject of the certificate, if null then the subject in the CSR is used.notBefore - Validity start date.notAfter - Validity end date.ocspUrl - If non-null then this is added as the OCSP URL for the certificate.caPrivKey - Private key for the CA, used to sign the certificate.caCert - The certificate relating to the caPrivKeyserialNumber - Certificate serial number, should be unique for this CA.policyOid - Optional OID for certificate policy, needs policyUrl as well.policyUrl - Optional URL for certificate policy, needs policyOid as well.certificateType - Type of certificate required, one of
UserEncryption, UserSigning or ServerInvalidKeyException - If the given keys are incompatible with this CipherSuite.SignatureVerificationException - If the CSR signature is not valid or cannot ve verified.org.bouncycastle.cert.X509AttributeCertificateHolder createAttributeCert(X509Certificate clientCert, Date notBefore, Date notAfter, URL ocspUrl, PrivateKey caPrivKey, X509Certificate caCert, BigInteger serialNumber, String policyOid, URL policyUrl, String attributeId, String attributeValue)
clientCert - User certificate for which this attribute applies.notBefore - Validity start date.notAfter - Validity end date.ocspUrl - If non-null then this is added as the OCSP URL for the certificate.caPrivKey - Private key for the CA, used to sign the certificate.caCert - The certificate relating to the caPrivKeyserialNumber - Certificate serial number, should be unique for this CA.policyOid - Optional OID for certificate policy, needs policyUrl as well.policyUrl - Optional URL for certificate policy, needs policyOid as well.attributeId - OID of the attribute.attributeValue - Value of the attribute.byte[] wrap(SecretKey key, PublicKey userKey) throws GeneralSecurityException
key - Key to be wrapped.userKey - Public key of user for whom it is wrapped. Only they can unwrap using their secret key.GeneralSecurityExceptionSecretKey unwrap(byte[] cipherText, PrivateKey userPrivateKey, ISymmetricCipherSuite symmetricCipherSuite) throws GeneralSecurityException
cipherText - Encrypted key to be unwrapped.userPrivateKey - Wrapping key.symmetricCipherSuite - Wrapping cipherSuiteGeneralSecurityExceptionString publicKeyToDER(PublicKey key) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionPublicKey publicKeyFromDER(String der) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionString privateKeyToDER(PrivateKey key) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionPrivateKey privateKeyFromDER(String der) throws IOException, GeneralSecurityException
IOExceptionGeneralSecurityExceptionint getKeySize(PublicKey key) throws InvalidKeyException
InvalidKeyExceptionint getKeySize(PrivateKey key) throws InvalidKeyException
InvalidKeyExceptionCopyright © 2018 Symphony Software Foundation. All rights reserved.