Class SignedPublicKeyAndChallenge
java.lang.Object
org.bouncycastle.mozilla.SignedPublicKeyAndChallenge
- All Implemented Interfaces:
org.bouncycastle.util.Encodable
- Direct Known Subclasses:
JcaSignedPublicKeyAndChallenge
This is designed to parse the SignedPublicKeyAndChallenge created by the
KEYGEN tag included by Mozilla based browsers.
PublicKeyAndChallenge ::= SEQUENCE {
spki SubjectPublicKeyInfo,
challenge IA5STRING
}
SignedPublicKeyAndChallenge ::= SEQUENCE {
publicKeyAndChallenge PublicKeyAndChallenge,
signatureAlgorithm AlgorithmIdentifier,
signature BIT STRING
}
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge -
Constructor Summary
ConstructorsModifierConstructorDescriptionSignedPublicKeyAndChallenge(byte[] bytes) Parse a SignedPublicKeyAndChallenge from its DER encoding.protectedSignedPublicKeyAndChallenge(org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge struct) Wrap an existing parsed SignedPublicKeyAndChallenge ASN.1 structure. -
Method Summary
Modifier and TypeMethodDescriptionReturn the challenge string the public key has been bound to.byte[]Return the default (DER) encoding of this SPKAC.getPublicKey(String provider) Deprecated.use JcaSignedPublicKeyAndChallenge.getPublicKey()org.bouncycastle.asn1.mozilla.PublicKeyAndChallengeReturn the inner PublicKeyAndChallenge structure (subject public key plus challenge string).org.bouncycastle.asn1.x509.SubjectPublicKeyInfoReturn the SubjectPublicKeyInfo carried by this SPKAC.booleanisSignatureValid(ContentVerifierProvider verifierProvider) Verify the signature on this SPKAC against the contained public key.org.bouncycastle.asn1.ASN1PrimitiveDeprecated.use toASN1Structureorg.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallengeReturn the underlying ASN.1 structure for this challenge.booleanverify()Deprecated.use ContentVerifierProvider methodbooleanDeprecated.use ContentVerifierProvider method
-
Field Details
-
spkacSeq
protected final org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge spkacSeq
-
-
Constructor Details
-
SignedPublicKeyAndChallenge
public SignedPublicKeyAndChallenge(byte[] bytes) Parse a SignedPublicKeyAndChallenge from its DER encoding.- Parameters:
bytes- the encoded SPKAC bytes (as produced by a Mozilla<keygen>submission).
-
SignedPublicKeyAndChallenge
protected SignedPublicKeyAndChallenge(org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge struct) Wrap an existing parsed SignedPublicKeyAndChallenge ASN.1 structure.- Parameters:
struct- the underlying ASN.1 structure.
-
-
Method Details
-
toASN1Structure
public org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge toASN1Structure()Return the underlying ASN.1 structure for this challenge.- Returns:
- a SignedPublicKeyAndChallenge object.
-
toASN1Primitive
public org.bouncycastle.asn1.ASN1Primitive toASN1Primitive()Deprecated.use toASN1Structure -
getPublicKeyAndChallenge
public org.bouncycastle.asn1.mozilla.PublicKeyAndChallenge getPublicKeyAndChallenge()Return the inner PublicKeyAndChallenge structure (subject public key plus challenge string). -
isSignatureValid
public boolean isSignatureValid(ContentVerifierProvider verifierProvider) throws OperatorCreationException, IOException Verify the signature on this SPKAC against the contained public key.- Parameters:
verifierProvider- a provider able to verify the signature algorithm declared by the SPKAC.- Returns:
trueif the signature is valid,falseotherwise.- Throws:
OperatorCreationException- if no verifier can be created for the signature algorithm.IOException- on a problem encoding the data to be verified.
-
verify
public boolean verify() throws NoSuchAlgorithmException, SignatureException, NoSuchProviderException, InvalidKeyExceptionDeprecated.use ContentVerifierProvider method -
verify
public boolean verify(String provider) throws NoSuchAlgorithmException, SignatureException, NoSuchProviderException, InvalidKeyException Deprecated.use ContentVerifierProvider method -
getSubjectPublicKeyInfo
public org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getSubjectPublicKeyInfo()Return the SubjectPublicKeyInfo carried by this SPKAC. -
getChallenge
Return the challenge string the public key has been bound to. -
getPublicKey
public PublicKey getPublicKey(String provider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException Deprecated.use JcaSignedPublicKeyAndChallenge.getPublicKey() -
getEncoded
Return the default (DER) encoding of this SPKAC.- Specified by:
getEncodedin interfaceorg.bouncycastle.util.Encodable- Returns:
- the encoded bytes.
- Throws:
IOException- if encoding fails.
-