SunSPOT host API V3.0


com.sun.squawk.security.signing
Class KeyUtil

java.lang.Object
  extended by com.sun.squawk.security.signing.KeyUtil

public class KeyUtil
extends Object

The KeyUtil class provides functions to encode and decode ECPublicKeys in the X9.62 encoding.

Author:
Christian Pühringer

Constructor Summary
KeyUtil()
           
 
Method Summary
static byte[] encodePublicECKeyInX962(ECPublicKey publicKey)
          Encodes a public key using X9.62
static ECPublicKey getPublicECKeyFromX962Encoding(byte[] publicKeyBA)
          gets the ECPublicKey from the X962 encoding in a byte array
static ECPublicKey getPublicECKeyFromX962Encoding(byte[] publicKeyBA, int offset, int length)
          gets the ECPublicKey from the X9.62 encoding in a byte array
static ECPublicKey getPublicECKeyFromX962Encoding(String publicKeyS)
          gets the ECPublicKey from the X962 encoding in a String
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyUtil

public KeyUtil()
Method Detail

encodePublicECKeyInX962

public static byte[] encodePublicECKeyInX962(ECPublicKey publicKey)
                                      throws CryptoException
Encodes a public key using X9.62

Parameters:
publicKey -
Returns:
the public key encoded using X9.62
Throws:
CryptoException

getPublicECKeyFromX962Encoding

public static ECPublicKey getPublicECKeyFromX962Encoding(byte[] publicKeyBA,
                                                         int offset,
                                                         int length)
                                                  throws CryptoException
gets the ECPublicKey from the X9.62 encoding in a byte array

Parameters:
publicKeyS - EC public key in X9.62 encoding. Must be a SEC160r key.
Returns:
ECPublicKey the Elliptic curve public key, or null if publicKeyS is not a valid key
Throws:
CryptoException

getPublicECKeyFromX962Encoding

public static ECPublicKey getPublicECKeyFromX962Encoding(byte[] publicKeyBA)
                                                  throws CryptoException
gets the ECPublicKey from the X962 encoding in a byte array

Parameters:
publicKeyS - EC public key in X962 encoding. Must be a SEC160r key.
Returns:
ECPublicKey the Elliptic curve public key, or null if publicKeyS is not a valid key
Throws:
CryptoException

getPublicECKeyFromX962Encoding

public static ECPublicKey getPublicECKeyFromX962Encoding(String publicKeyS)
                                                  throws CryptoException
gets the ECPublicKey from the X962 encoding in a String

Parameters:
publicKeyS - EC public key in X962 encoding. Must be a SEC160r key.
Returns:
ECPublicKey the Elliptic curve public key, or null if publicKeyS is not a valid key
Throws:
CryptoException

SunSPOT host API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.