public class SignaturePOP extends ProofOfPossession
signature
.ProofOfPossession
,
RAVerifiedPOP
,
KeyEnciphermentPOP
,
KeyAgreementPOP
ProofOfPossession.SubsequentMsg, ProofOfPossession.Type
Constructor and Description |
---|
SignaturePOP()
Create an empty
SignaturePOP . |
SignaturePOP(AlgorithmIdentifier sigAlgID)
Create a
SignaturePOP with the given signature algorithm
to sign the CertRequest from the enclosing CertReqMsg . |
SignaturePOP(AlgorithmIdentifier sigAlgID,
java.security.PublicKey pubKey,
byte[] password)
Create a
SignaturePOP with the given signature algorithm to sign
the given public key and a PasswordBasedMAC of the public key using
the given password bytes. |
SignaturePOP(AlgorithmIdentifier sigAlgID,
java.security.PublicKey pubKey,
byte[] password,
java.security.SecureRandom sr)
Note the changes in the method signature
|
SignaturePOP(AlgorithmIdentifier sigAlgID,
java.security.PublicKey pubKey,
GeneralName sender)
Create a
SignaturePOP with the given signature algorithm
to sign the given public key and sender name. |
Modifier and Type | Method and Description |
---|---|
AlgorithmIdentifier |
getMacAlgID()
Returns the password-based-MAC algorithm identifier.
|
byte[] |
getMacBytes()
Returns the bytes of the public key password-based-MAC.
|
java.security.PublicKey |
getPublicKey()
Returns the public key if it was provided separately from the
CertRequest 's CertTemplate . |
GeneralName |
getSenderName()
Returns the sender's name if it was provided separately from the
CertRequest 's CertTemplate . |
AlgorithmIdentifier |
getSignatureAlgID()
Returns the algorithm identifier for the signature.
|
byte[] |
getSignatureBytes() |
ProofOfPossession.Type |
getType()
Returns one of the values defined in
ProofOfPossession.Type . |
void |
input(java.io.InputStream is) |
void |
sign(CertRequest certReq,
java.security.PrivateKey privKey,
java.security.SecureRandom sr)
Computes the signature for this
SignaturePOP using the
the enclosing CertReqMsg 's CertRequest . |
void |
sign(java.security.PrivateKey privKey,
java.security.SecureRandom sr)
Computes the signature for this
SignaturePOP using the
public key and sender name or the password-based MAC of the public key. |
java.lang.String |
toString() |
boolean |
verify(java.security.PublicKey pubKey,
byte[] password)
Verify the public key MAC in this POP's
POPOSigningKeyInput
structure and the signature on the structure. |
boolean |
verify(java.security.PublicKey pubKey,
CertRequest certReq)
Verify the POP signature on the enclosing
CertReqMsg 's
CertRequest . |
boolean |
verify(java.security.PublicKey pubKey,
GeneralName sender)
Verify the sender name in this POP's
POPOSigningKeyInput
structure and the signature on the structure. |
inputInstance, length, output
public SignaturePOP()
SignaturePOP
. The resulting object is not a
valid proof-of-possession structure, and is intended primarily for use
in conjunction with the input(java.io.InputStream)
method.public SignaturePOP(AlgorithmIdentifier sigAlgID)
SignaturePOP
with the given signature algorithm
to sign the CertRequest
from the enclosing CertReqMsg
.
Note: This constructor must be used when the CertRequest
's CertTemplate
contains both the public key and subject name. Otherwise, use either the
SignaturePOP(AlgorithmIdentifier, PublicKey, GeneralName)
or the
SignaturePOP(AlgorithmIdentifier, PublicKey, byte[])
constructor.
sigAlgID
- The signature algorithm to use.public SignaturePOP(AlgorithmIdentifier sigAlgID, java.security.PublicKey pubKey, GeneralName sender) throws java.security.InvalidKeyException
SignaturePOP
with the given signature algorithm
to sign the given public key and sender name.
Note: This constructor (or SignaturePOP(AlgorithmIdentifier, PublicKey, byte[])
)
must be used only when the CertRequest
's CertTemplate
does not
contain both the public key and subject name. If neither value is missing from the template use the constructor
SignaturePOP(AlgorithmIdentifier)
.
Note the changes in the method signature
Previously public SignaturePOP (AlgorithmIdentifier , oracle.security.crypto.core.PublicKey , GeneralName )
Now public SignaturePOP (AlgorithmIdentifier , java.security.PublicKey, GeneralName )
sigAlgID
- The signature algorithm to use.pubKey
- The subject public key of the certificate request.sender
- The sender's GeneralName
.java.security.InvalidKeyException
public SignaturePOP(AlgorithmIdentifier sigAlgID, java.security.PublicKey pubKey, byte[] password) throws java.security.NoSuchAlgorithmException, AlgorithmIdentifierException
SignaturePOP
with the given signature algorithm to sign
the given public key and a PasswordBasedMAC
of the public key using
the given password bytes.
Note: This constructor (or SignaturePOP(AlgorithmIdentifier, PublicKey pubKey, GeneralName sender)
)
must be used only when the CertRequest
's CertTemplate
does not
contain both the public key and subject name. If neither value is missing from the template, use the constructor
SignaturePOP(AlgorithmIdentifier)
.
Note the changes in the method signature
Previously public SignaturePOP (AlgorithmIdentifier , oracle.security.crypto.core.PublicKey , byte[] )
Now public SignaturePOP (AlgorithmIdentifier , java.security.PublicKey, byte[])
Note the changes in the exceptions thrown
Exceptions introduced -- NoSuchAlgorithmException
sigAlgID
- The signature algorithm to use.pubKey
- The subject public key of the certificate request.password
- The bytes of the shared secret to be used in computing a password-based MAC.
It is recommended (PKCS #5) that the password be at least 12 bytes, to complement
a default salt length of 8 bytes and a hash value length of 20 bytes (SHA-1).java.security.NoSuchAlgorithmException
AlgorithmIdentifierException
public SignaturePOP(AlgorithmIdentifier sigAlgID, java.security.PublicKey pubKey, byte[] password, java.security.SecureRandom sr) throws AlgorithmIdentifierException
Note the changes in the method signature
Previously public SignaturePOP (AlgorithmIdentifier , oracle.security.crypto.core.PublicKey , byte[] , RandomBitsSource )
Now public SignaturePOP (AlgorithmIdentifier , java.security.PublicKey , byte[], SecureRandom)
AlgorithmIdentifierException
public ProofOfPossession.Type getType()
ProofOfPossession
ProofOfPossession.Type
.getType
in class ProofOfPossession
public void sign(java.security.PrivateKey privKey, java.security.SecureRandom sr) throws java.security.SignatureException
SignaturePOP
using the
public key and sender name or the password-based MAC of the public key.
If this method is not invoked explicitly on the SignaturePOP
instance, it will be called by the enclosing CertReqMsg
's
constructor.
Note the changes in the method signature
Previouslypublic void sign (oracle.security.crypto.core.PrivateKey , RandomBitsSource)
Now public void sign (java.security.PrivateKey , SecureRandom )
Note: This method must be used only when the CertRequest
's
CertTemplate
does not contain both the public key
and subject name. If neither value is missing from the template use the
SignaturePOP(AlgorithmIdentifier)
constructor and the signing method
sign(CertRequest, PrivateKey, SecureRandom)
.
java.security.SignatureException
public void sign(CertRequest certReq, java.security.PrivateKey privKey, java.security.SecureRandom sr) throws java.security.SignatureException
SignaturePOP
using the
the enclosing CertReqMsg
's CertRequest
.
If this method is not invoked explicitly on the SignaturePOP
instance, it will be called by the enclosing CertReqMsg
's
constructor.
Note the changes in the method signature
Previouslypublic void sign (CertRequest ,oracle.security.crypto.core.PrivateKey , RandomBitsSource)
Now public void sign (CertRequest ,java.security.PrivateKey , SecureRandom )
Note: This method must be used only when the CertRequest
's
CertTemplate
contains both the public key
and subject name. If either value is missing from the template use the
SignaturePOP(AlgorithmIdentifier, PublicKey, GeneralName)
or the
SignaturePOP(AlgorithmIdentifier, PublicKey, byte[])
constructor,
and the signing method sign(PrivateKey, SecureRandom)
.
java.security.SignatureException
public boolean verify(java.security.PublicKey pubKey, CertRequest certReq) throws java.security.SignatureException
CertReqMsg
's
CertRequest
.
Note the changes in the method signature
Previouslypublic boolean verify (oracle.security.crypto.core.PublicKey , CertRequest )
Now public boolean verify (java.security.PublicKey , CertRequest )
pubKey
- The public key intended for the certificate, preferably taken
from the CertRequest
's CertTemplate
.certReq
- The CertRequest
structure.java.security.SignatureException
public boolean verify(java.security.PublicKey pubKey, GeneralName sender) throws java.security.SignatureException
POPOSigningKeyInput
structure and the signature on the structure.
Note the changes in the method signature
Previouslypublic boolean verify (oracle.security.crypto.core.PublicKey , GeneralName )
Now public boolean verify (java.security.PublicKey , GeneralName )
pubKey
- The public key intended for the certificate, preferably taken
from the CertRequest
's CertTemplate
.sender
- The sender's name, preferably taken from the message header.java.security.SignatureException
public boolean verify(java.security.PublicKey pubKey, byte[] password) throws java.security.SignatureException, InvalidMACException
POPOSigningKeyInput
structure and the signature on the structure.
Note the changes in the method signature
Previouslypublic boolean verify (oracle.security.crypto.core.PublicKey , byte[] )
Now public boolean verify (java.security.PublicKey , byte[] )
pubKey
- The public key intended for the certificate, preferably taken
from the CertRequest
's CertTemplate
.password
- The shared secret for the password-based-MAC on the public key.java.security.SignatureException
InvalidMACException
public AlgorithmIdentifier getSignatureAlgID()
public byte[] getSignatureBytes()
public GeneralName getSenderName()
CertRequest
's CertTemplate
.GeneralName
if present,
otherwise null
.public AlgorithmIdentifier getMacAlgID()
PBMacAlgID
if present, otherwise null
.public byte[] getMacBytes()
null
.public java.security.PublicKey getPublicKey()
CertRequest
's CertTemplate
.null
.
Note : This method returns a java.security.PublicKeypublic java.lang.String toString()
toString
in class java.lang.Object
public void input(java.io.InputStream is) throws java.io.IOException
java.io.IOException