Class JcaTlsRawKeyCertificate
java.lang.Object
org.bouncycastle.tls.crypto.impl.jcajce.JcaTlsRawKeyCertificate
- All Implemented Interfaces:
TlsCertificate
- Direct Known Subclasses:
JcaTlsCertificate
Implementation class for a raw public key (RFC 7250) based on the JCA. The certificate is just a
DER-encoded SubjectPublicKeyInfo, with no X.509 metadata: it has no serial number, signature
algorithm, extensions or KeyUsage, so all signature/encryption uses are permitted by the key
itself.
This is the base class for JcaTlsCertificate (an X.509 certificate is a SubjectPublicKeyInfo
plus X.509 metadata); subclasses override getPublicKey(),
getSubjectPublicKeyInfo(), supportsKeyUsageBit(int) and the X.509 accessors
(getEncoded(), getExtension(ASN1ObjectIdentifier), getSerialNumber(),
getSigAlgOID(), getSigAlgParams()) to source them from the certificate. This
mirrors the lightweight BcTlsCertificate extends BcTlsRawKeyCertificate structure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JcaTlsCryptoprotected final org.bouncycastle.asn1.x509.SubjectPublicKeyInfoprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected DHPublicKeyprotected ECPublicKeyprotected PublicKey -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJcaTlsRawKeyCertificate(JcaTlsCrypto crypto) For subclasses (e.g.JcaTlsRawKeyCertificate(JcaTlsCrypto crypto, byte[] keyInfo) JcaTlsRawKeyCertificate(JcaTlsCrypto crypto, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo keyInfo) -
Method Summary
Modifier and TypeMethodDescriptioncheckUsageInRole(int tlsCertificateRole) createEncryptor(int tlsCertificateRole) Return an encryptor based on the public key in this certificate.createVerifier(int signatureScheme) createVerifier(short signatureAlgorithm) byte[]byte[]getExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier extensionOID) shortprotected PublicKeyorg.bouncycastle.asn1.ASN1Encodableprotected org.bouncycastle.asn1.x509.SubjectPublicKeyInfoprotected booleanimplSupportsSignatureAlgorithm(short signatureAlgorithm) protected booleansupportsKeyUsageBit(int keyUsageBit) protected booleansupportsMLDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier mlDsaAlgOid) protected booleanprotected booleansupportsRSA_PSS_PSS(short signatureAlgorithm) protected booleanbooleansupportsSignatureAlgorithm(short signatureAlgorithm) booleansupportsSignatureAlgorithmCA(short signatureAlgorithm) protected booleansupportsSLHDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier slhDsaAlgOid) protected voidvalidateKeyUsageBit(int keyUsageBit) protected voidvalidateMLDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier mlDsaAlgOid) protected voidprotected voidvalidateRSA_PSS_PSS(short signatureAlgorithm) protected voidprotected voidvalidateSLHDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier slhDsaAlgOid)
-
Field Details
-
KU_DIGITAL_SIGNATURE
protected static final int KU_DIGITAL_SIGNATURE- See Also:
-
KU_NON_REPUDIATION
protected static final int KU_NON_REPUDIATION- See Also:
-
KU_KEY_ENCIPHERMENT
protected static final int KU_KEY_ENCIPHERMENT- See Also:
-
KU_DATA_ENCIPHERMENT
protected static final int KU_DATA_ENCIPHERMENT- See Also:
-
KU_KEY_AGREEMENT
protected static final int KU_KEY_AGREEMENT- See Also:
-
KU_KEY_CERT_SIGN
protected static final int KU_KEY_CERT_SIGN- See Also:
-
KU_CRL_SIGN
protected static final int KU_CRL_SIGN- See Also:
-
KU_ENCIPHER_ONLY
protected static final int KU_ENCIPHER_ONLY- See Also:
-
KU_DECIPHER_ONLY
protected static final int KU_DECIPHER_ONLY- See Also:
-
crypto
-
keyInfo
protected final org.bouncycastle.asn1.x509.SubjectPublicKeyInfo keyInfo -
pubKeyDH
-
pubKeyEC
-
pubKeyRSA
-
-
Constructor Details
-
JcaTlsRawKeyCertificate
-
JcaTlsRawKeyCertificate
public JcaTlsRawKeyCertificate(JcaTlsCrypto crypto, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo keyInfo) -
JcaTlsRawKeyCertificate
For subclasses (e.g.JcaTlsCertificate) that source the public key from elsewhere and overridegetPublicKey()/getSubjectPublicKeyInfo().
-
-
Method Details
-
createEncryptor
Description copied from interface:TlsCertificateReturn an encryptor based on the public key in this certificate.- Specified by:
createEncryptorin interfaceTlsCertificate- Parameters:
tlsCertificateRole-TlsCertificateRole- Returns:
- a TlsEncryptor based on this certificate's public key.
- Throws:
IOException
-
createVerifier
- Specified by:
createVerifierin interfaceTlsCertificate- Parameters:
signatureAlgorithm-SignatureAlgorithm- Throws:
IOException
-
createVerifier
- Specified by:
createVerifierin interfaceTlsCertificate- Parameters:
signatureScheme-SignatureScheme- Throws:
IOException
-
getEncoded
- Specified by:
getEncodedin interfaceTlsCertificate- Throws:
IOException
-
getExtension
public byte[] getExtension(org.bouncycastle.asn1.ASN1ObjectIdentifier extensionOID) throws IOException - Specified by:
getExtensionin interfaceTlsCertificate- Throws:
IOException
-
getSerialNumber
- Specified by:
getSerialNumberin interfaceTlsCertificate
-
getSigAlgOID
- Specified by:
getSigAlgOIDin interfaceTlsCertificate- Returns:
- the OID of this certificate's 'signatureAlgorithm', as a String.
-
getSigAlgParams
- Specified by:
getSigAlgParamsin interfaceTlsCertificate- Throws:
IOException
-
getLegacySignatureAlgorithm
- Specified by:
getLegacySignatureAlgorithmin interfaceTlsCertificate- Returns:
SignatureAlgorithm- Throws:
IOException
-
supportsSignatureAlgorithm
- Specified by:
supportsSignatureAlgorithmin interfaceTlsCertificate- Parameters:
signatureAlgorithm-SignatureAlgorithm- Returns:
- true if (and only if) this certificate can be used to verify the given signature algorithm.
- Throws:
IOException
-
supportsSignatureAlgorithmCA
- Specified by:
supportsSignatureAlgorithmCAin interfaceTlsCertificate- Throws:
IOException
-
checkUsageInRole
- Specified by:
checkUsageInRolein interfaceTlsCertificate- Parameters:
tlsCertificateRole-TlsCertificateRole- Throws:
IOException
-
implSupportsSignatureAlgorithm
- Throws:
IOException
-
getPublicKey
- Throws:
IOException
-
getSubjectPublicKeyInfo
protected org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getSubjectPublicKeyInfo() throws IOException- Throws:
IOException
-
supportsKeyUsageBit
protected boolean supportsKeyUsageBit(int keyUsageBit) -
supportsMLDSA
protected boolean supportsMLDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier mlDsaAlgOid) throws IOException - Throws:
IOException
-
supportsRSA_PKCS1
- Throws:
IOException
-
supportsRSA_PSS_PSS
- Throws:
IOException
-
supportsRSA_PSS_RSAE
- Throws:
IOException
-
supportsSLHDSA
protected boolean supportsSLHDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier slhDsaAlgOid) throws IOException - Throws:
IOException
-
validateKeyUsageBit
- Throws:
IOException
-
validateMLDSA
protected void validateMLDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier mlDsaAlgOid) throws IOException - Throws:
IOException
-
validateRSA_PKCS1
- Throws:
IOException
-
validateRSA_PSS_PSS
- Throws:
IOException
-
validateRSA_PSS_RSAE
- Throws:
IOException
-
validateSLHDSA
protected void validateSLHDSA(org.bouncycastle.asn1.ASN1ObjectIdentifier slhDsaAlgOid) throws IOException - Throws:
IOException
-