com.google.api.client.auth
Class RsaSha

java.lang.Object
  extended by com.google.api.client.auth.RsaSha

public class RsaSha
extends Object

Utility methods for "RSA-SHA1" signing method.

Since:
1.0
Author:
Yaniv Inbar

Method Summary
static PrivateKey getPrivateKeyFromKeystore(InputStream keyStream, String storePass, String alias, String keyPass)
          Retrieves the private key from the specified key store.
static PrivateKey getPrivateKeyFromPk8(File file)
          Reads a PKCS#8 format private key from a given file.
static String sign(PrivateKey privateKey, String data)
          Signs the given data using the given private key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPrivateKeyFromKeystore

public static PrivateKey getPrivateKeyFromKeystore(InputStream keyStream,
                                                   String storePass,
                                                   String alias,
                                                   String keyPass)
                                            throws IOException,
                                                   GeneralSecurityException
Retrieves the private key from the specified key store.

Parameters:
keyStream - input stream to the key store file
storePass - password protecting the key store file
alias - alias under which the private key is stored
keyPass - password protecting the private key
Returns:
the private key from the specified key store
Throws:
GeneralSecurityException - if the key store cannot be loaded
IOException - if the file cannot be accessed

getPrivateKeyFromPk8

public static PrivateKey getPrivateKeyFromPk8(File file)
                                       throws IOException,
                                              GeneralSecurityException
Reads a PKCS#8 format private key from a given file.

Throws:
NoSuchAlgorithmException
IOException
GeneralSecurityException

sign

public static String sign(PrivateKey privateKey,
                          String data)
                   throws GeneralSecurityException
Signs the given data using the given private key.

Throws:
GeneralSecurityException - general security exception


Copyright © 2010-2011 Google. All Rights Reserved.