Bouncy Castle Cryptography Library 1.87

org.bouncycastle.mozilla
Class SignedPublicKeyAndChallenge

java.lang.Object
  extended byorg.bouncycastle.mozilla.SignedPublicKeyAndChallenge
All Implemented Interfaces:
org.bouncycastle.util.Encodable
Direct Known Subclasses:
JcaSignedPublicKeyAndChallenge

public class SignedPublicKeyAndChallenge
extends java.lang.Object
implements org.bouncycastle.util.Encodable

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
protected  org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge spkacSeq
           
 
Constructor Summary
  SignedPublicKeyAndChallenge(byte[] bytes)
          Parse a SignedPublicKeyAndChallenge from its DER encoding.
protected SignedPublicKeyAndChallenge(org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge struct)
          Wrap an existing parsed SignedPublicKeyAndChallenge ASN.1 structure.
 
Method Summary
 java.lang.String getChallenge()
          Return the challenge string the public key has been bound to.
 byte[] getEncoded()
          Return the default (DER) encoding of this SPKAC.
 java.security.PublicKey getPublicKey(java.lang.String provider)
          Deprecated. use JcaSignedPublicKeyAndChallenge.getPublicKey()
 org.bouncycastle.asn1.mozilla.PublicKeyAndChallenge getPublicKeyAndChallenge()
          Return the inner PublicKeyAndChallenge structure (subject public key plus challenge string).
 org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getSubjectPublicKeyInfo()
          Return the SubjectPublicKeyInfo carried by this SPKAC.
 boolean isSignatureValid(ContentVerifierProvider verifierProvider)
          Verify the signature on this SPKAC against the contained public key.
 org.bouncycastle.asn1.ASN1Primitive toASN1Primitive()
          Deprecated. use toASN1Structure
 org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge toASN1Structure()
          Return the underlying ASN.1 structure for this challenge.
 boolean verify()
          Deprecated. use ContentVerifierProvider method
 boolean verify(java.lang.String provider)
          Deprecated. use ContentVerifierProvider method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

spkacSeq

protected final org.bouncycastle.asn1.mozilla.SignedPublicKeyAndChallenge spkacSeq
Constructor Detail

SignedPublicKeyAndChallenge

public SignedPublicKeyAndChallenge(byte[] bytes)
Parse a SignedPublicKeyAndChallenge from its DER encoding.

Parameters:
bytes - the encoded SPKAC bytes (as produced by a Mozilla 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 Detail

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,
                                java.io.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:
if the signature is valid, otherwise.
Throws:
OperatorCreationException - if no verifier can be created for the signature algorithm.
java.io.IOException - on a problem encoding the data to be verified.

verify

public boolean verify()
               throws java.security.NoSuchAlgorithmException,
                      java.security.SignatureException,
                      java.security.NoSuchProviderException,
                      java.security.InvalidKeyException
Deprecated. use ContentVerifierProvider method

Throws:
java.security.NoSuchAlgorithmException
java.security.SignatureException
java.security.NoSuchProviderException
java.security.InvalidKeyException

verify

public boolean verify(java.lang.String provider)
               throws java.security.NoSuchAlgorithmException,
                      java.security.SignatureException,
                      java.security.NoSuchProviderException,
                      java.security.InvalidKeyException
Deprecated. use ContentVerifierProvider method

Throws:
java.security.NoSuchAlgorithmException
java.security.SignatureException
java.security.NoSuchProviderException
java.security.InvalidKeyException

getSubjectPublicKeyInfo

public org.bouncycastle.asn1.x509.SubjectPublicKeyInfo getSubjectPublicKeyInfo()
Return the SubjectPublicKeyInfo carried by this SPKAC.


getChallenge

public java.lang.String getChallenge()
Return the challenge string the public key has been bound to.


getPublicKey

public java.security.PublicKey getPublicKey(java.lang.String provider)
                                     throws java.security.NoSuchAlgorithmException,
                                            java.security.NoSuchProviderException,
                                            java.security.InvalidKeyException
Deprecated. use JcaSignedPublicKeyAndChallenge.getPublicKey()

Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.InvalidKeyException

getEncoded

public byte[] getEncoded()
                  throws java.io.IOException
Return the default (DER) encoding of this SPKAC.

Specified by:
getEncoded in interface org.bouncycastle.util.Encodable
Returns:
the encoded bytes.
Throws:
java.io.IOException - if encoding fails.

Bouncy Castle Cryptography Library 1.87