iaik.cms
Class OriginatorPublicKey

java.lang.Object
  extended by iaik.cms.OriginatorPublicKey
All Implemented Interfaces:
ASN1Type, KeyIdentifier

public class OriginatorPublicKey
extends java.lang.Object
implements KeyIdentifier

The CMS type OriginatorPublicKey.

The OriginatorPublicKey type is used as one alternative for identifying the public key of the originator within a KeyAgreeRecipientInfo (see RFC 5652):

 OriginatorPublicKey ::= SEQUENCE {
    algorithm AlgorithmIdentifier
    publicKey BIT STRING }
 


Field Summary
 
Fields inherited from interface iaik.cms.KeyIdentifier
ISSUER_AND_SERIALNUMBER, KEK_IDENTIFIER, ORIGINATOR_PUBLIC_KEY, RECIPIENT_KEY_IDENTIFIER, SUBJECT_KEY_IDENTIFIER
 
Constructor Summary
OriginatorPublicKey()
          Empty default constructor.
OriginatorPublicKey(ASN1Object obj)
          Creates an OriginatorPublicKey from an ASN1Object.
OriginatorPublicKey(ASN1Object obj, SecurityProvider securityProvider)
          Creates an OriginatorPublicKey from an ASN1Object.
OriginatorPublicKey(java.security.PublicKey publicKey)
          Creates a OriginatorPublicKey for the given public key.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the OriginatorPublicKey from the given ASN1Object.
 boolean equals(java.lang.Object obj)
          Compares this OriginatorPublicKey to the specified object.
 int getKeyIdType()
          Returns the key identifier type this class represents.
 java.lang.String getKeyIdTypeName()
          Returns the key identifier type this class represents as string.
 java.security.PublicKey getPublicKey()
          Gets the public key.
 int hashCode()
          Returns a hashcode for this OriginatorPublicKey.
 ASN1Object toASN1Object()
          Returns this OriginatorPublicKey as ASN1Object.
 java.lang.String toString()
          Returns a String representation of this OriginatorPublicKey.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OriginatorPublicKey

public OriginatorPublicKey()
Empty default constructor.

Used for dynamic object creation only. Shall be not used by an application.


OriginatorPublicKey

public OriginatorPublicKey(java.security.PublicKey publicKey)
Creates a OriginatorPublicKey for the given public key.

Parameters:
publicKey - the public key

OriginatorPublicKey

public OriginatorPublicKey(ASN1Object obj)
                    throws CodingException
Creates an OriginatorPublicKey from an ASN1Object.

Parameters:
obj - the OriginatorPublicKey as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be decoded or is invalid structured

OriginatorPublicKey

public OriginatorPublicKey(ASN1Object obj,
                           SecurityProvider securityProvider)
                    throws CodingException
Creates an OriginatorPublicKey from an ASN1Object.

Parameters:
obj - the OriginatorPublicKey as ASN1Object
securityProvider - the SecurityProvider to be used by this object, if null use the default system-wide installed SecurityProvider; SecurityProvider method getKeyFactory may be required to get a KeyFactory required for parsing the encoded key
Throws:
CodingException - if the ASN1Object cannot be decoded or is invalid structured
Method Detail

getPublicKey

public java.security.PublicKey getPublicKey()
Gets the public key.

Returns:
the public key

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes the OriginatorPublicKey from the given ASN1Object.

Specified by:
decode in interface ASN1Type
Parameters:
obj - the OriginatorPublicKey as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be decoded or is invalid structured

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this OriginatorPublicKey as ASN1Object.

Specified by:
toASN1Object in interface ASN1Type
Returns:
this OriginatorPublicKey as ASN1Object
Throws:
CodingException - if this OriginatorPublicKey cannot be represented as ASN.1 object

equals

public boolean equals(java.lang.Object obj)
Compares this OriginatorPublicKey to the specified object.

Specified by:
equals in interface KeyIdentifier
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this OriginatorPublicKey against.
Returns:
true, if the given object is equal to this OriginatorPublicKey, false otherwise

hashCode

public int hashCode()
Returns a hashcode for this OriginatorPublicKey.

Specified by:
hashCode in interface KeyIdentifier
Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode for this OriginatorPublicKey

getKeyIdType

public int getKeyIdType()
Returns the key identifier type this class represents.

Specified by:
getKeyIdType in interface KeyIdentifier
Returns:
the key id type ORIGINATOR_PUBLIC_KEY (4)

getKeyIdTypeName

public java.lang.String getKeyIdTypeName()
Returns the key identifier type this class represents as string.

Specified by:
getKeyIdTypeName in interface KeyIdentifier
Returns:
"OriginatorPublicKey"

toString

public java.lang.String toString()
Returns a String representation of this OriginatorPublicKey.

Specified by:
toString in interface KeyIdentifier
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this OriginatorPublicKey

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 6.0, (c) 2002 IAIK, (c) 2003, 2023 SIC