JSS 3.1.1

org.mozilla.jss.pkcs11
Class PK11PubKey

java.lang.Object
  |
  +--org.mozilla.jss.pkcs11.PK11Key
        |
        +--org.mozilla.jss.pkcs11.PK11PubKey
All Implemented Interfaces:
java.security.Key, java.security.PublicKey, java.io.Serializable
Direct Known Subclasses:
PK11DSAPublicKey, PK11RSAPublicKey

public class PK11PubKey
extends PK11Key
implements java.security.PublicKey

See Also:
Serialized Form

Fields inherited from class org.mozilla.jss.pkcs11.PK11Key
keyProxy
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
protected PK11PubKey(byte[] pointer)
           
 
Method Summary
private static PK11PubKey DSAFromRaw(byte[] rawKey)
           
static PK11PubKey fromRaw(PrivateKey.Type type, byte[] rawKey)
          Creates a PK11PubKey from its raw form.
 byte[] getEncoded()
          Returns a DER-encoded SubjectPublicKeyInfo representing this key.
 java.lang.String getFormat()
          The name of the primary encoding format of this key.
 KeyType getKeyType()
           
private static PK11PubKey RSAFromRaw(byte[] rawKey)
           
 void verifyKeyIsOnToken(PK11Token token)
          Make sure this key lives on the given token.
 
Methods inherited from class org.mozilla.jss.pkcs11.PK11Key
getAlgorithm, readObject, writeObject
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface java.security.Key
getAlgorithm
 

Constructor Detail

PK11PubKey

protected PK11PubKey(byte[] pointer)
Method Detail

verifyKeyIsOnToken

public void verifyKeyIsOnToken(PK11Token token)
                        throws NoSuchItemOnTokenException
Make sure this key lives on the given token.

getKeyType

public KeyType getKeyType()

fromRaw

public static PK11PubKey fromRaw(PrivateKey.Type type,
                                 byte[] rawKey)
                          throws InvalidKeyFormatException
Creates a PK11PubKey from its raw form. The raw form is a DER encoding of the public key. For example, this is what is stored in a SubjectPublicKeyInfo.
Parameters:
type - The type of private key to be decoded.
rawKey - The bytes of the raw key.
Throws:
InvalidKeyFormatException - If the raw key could not be decoded.

RSAFromRaw

private static PK11PubKey RSAFromRaw(byte[] rawKey)

DSAFromRaw

private static PK11PubKey DSAFromRaw(byte[] rawKey)

getEncoded

public byte[] getEncoded()
Returns a DER-encoded SubjectPublicKeyInfo representing this key.
Specified by:
getEncoded in interface java.security.Key
Overrides:
getEncoded in class PK11Key

getFormat

public java.lang.String getFormat()
The name of the primary encoding format of this key. The primary encoding format is X.509 SubjectPublicKeyInfo, and the name is "X.509".
Specified by:
getFormat in interface java.security.Key
Overrides:
getFormat in class PK11Key

JSS 3.1.1