0
votes

I'm trying to use a Google's OAuth 2.0 for Server to Server Applications and I ran into a roadblock.

It states:

"Sign the UTF-8 representation of the input using SHA256withRSA (also known as RSASSA-PKCS1-V1_5-SIGN with the SHA-256 hash function) with the private key obtained from the API console. The output will be a byte array."

So I got most of down using Java libraries but how do I use a String as a private key?

1
What characters does the character string contain? Digits and letters A-F? Digits and a mix of upper- and lower-case letters? How many characters are in it?erickson

1 Answers

0
votes

I guess you need a fixed size key. So you can get the String, hash the String and the result is your key for RSA. Maybe this also helps:

bytes[] values = myString.getBytes();  //get byte[] from String