Google Data APIs Client Library (1.41.1)



com.google.gdata.client.authn.oauth
Class RsaSha1PrivateKeyHelper

java.lang.Object
  extended by com.google.gdata.client.authn.oauth.RsaSha1PrivateKeyHelper

public class RsaSha1PrivateKeyHelper
extends java.lang.Object

A collection of methods to load an RSA-SHA1 PrivateKey object from various sources. The key should be a Base-64 encoded private key string conforming to the PKCS #8 standard.


Method Summary
static java.security.PrivateKey getPrivateKey(byte[] privateKeyBytes)
          Retrieves a PrivateKey from an array of bytes.
static java.security.PrivateKey getPrivateKey(java.io.File file)
          Retrieves a PrivateKey from a file.
static java.security.PrivateKey getPrivateKey(java.io.Reader privateKeyReader)
          Retrieves a PrivateKey from a reader.
static java.security.PrivateKey getPrivateKey(java.lang.String privateKeyString)
          Retrieves a PrivateKey from a string.
static java.security.PrivateKey getPrivateKeyFromFilename(java.lang.String filename)
          Retrieves a PrivateKey from a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPrivateKeyFromFilename

public static java.security.PrivateKey getPrivateKeyFromFilename(java.lang.String filename)
                                                          throws com.google.gdata.util.common.util.Base64DecoderException,
                                                                 java.security.spec.InvalidKeySpecException,
                                                                 java.io.IOException,
                                                                 java.security.NoSuchAlgorithmException
Retrieves a PrivateKey from a file.

Parameters:
filename - The filename from which to load the private key.
Returns:
A PrivateKey object.
Throws:
com.google.gdata.util.common.util.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.io.IOException
java.security.NoSuchAlgorithmException

getPrivateKey

public static java.security.PrivateKey getPrivateKey(java.io.File file)
                                              throws com.google.gdata.util.common.util.Base64DecoderException,
                                                     java.security.spec.InvalidKeySpecException,
                                                     java.io.IOException,
                                                     java.security.NoSuchAlgorithmException
Retrieves a PrivateKey from a file.

Parameters:
file - The File object from which to load the private key.
Returns:
A PrivateKey object.
Throws:
com.google.gdata.util.common.util.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.io.IOException
java.security.NoSuchAlgorithmException

getPrivateKey

public static java.security.PrivateKey getPrivateKey(java.io.Reader privateKeyReader)
                                              throws com.google.gdata.util.common.util.Base64DecoderException,
                                                     java.security.spec.InvalidKeySpecException,
                                                     java.io.IOException,
                                                     java.security.NoSuchAlgorithmException
Retrieves a PrivateKey from a reader.

Parameters:
privateKeyReader - The Reader object from which to load the private key.
Returns:
A PrivateKey object.
Throws:
com.google.gdata.util.common.util.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.io.IOException
java.security.NoSuchAlgorithmException

getPrivateKey

public static java.security.PrivateKey getPrivateKey(java.lang.String privateKeyString)
                                              throws com.google.gdata.util.common.util.Base64DecoderException,
                                                     java.security.spec.InvalidKeySpecException,
                                                     java.security.NoSuchAlgorithmException
Retrieves a PrivateKey from a string.

Parameters:
privateKeyString - The string from which to load the private key.
Returns:
A PrivateKey object.
Throws:
com.google.gdata.util.common.util.Base64DecoderException
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException

getPrivateKey

public static java.security.PrivateKey getPrivateKey(byte[] privateKeyBytes)
                                              throws java.security.spec.InvalidKeySpecException,
                                                     java.security.NoSuchAlgorithmException
Retrieves a PrivateKey from an array of bytes.

Parameters:
privateKeyBytes - The array of bytes from which to load the private key.
Returns:
A PrivateKey object.
Throws:
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException