Added comments
parent
c87346a4ab
commit
48595a62bb
|
@ -17,11 +17,17 @@ public class Hmac256Signer extends AbstractJwtSigner {
|
|||
|
||||
private byte[] passphrase;
|
||||
|
||||
/**
|
||||
* Create a signer with no passphrase
|
||||
*/
|
||||
public Hmac256Signer() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a signer with the given passphrase
|
||||
* @param passphrase
|
||||
*/
|
||||
public Hmac256Signer(byte[] passphrase) {
|
||||
super(HS256);
|
||||
|
||||
|
|
|
@ -22,20 +22,19 @@ import com.google.common.collect.Lists;
|
|||
*/
|
||||
public class Rs256Signer extends AbstractJwtSigner {
|
||||
|
||||
//TODO: should this class generate a new private key or get one passed into the constructor?
|
||||
private PrivateKey privateKey;
|
||||
//TODO: where does the publicKey come from?
|
||||
private PublicKey publicKey;
|
||||
|
||||
|
||||
private Signature signer;
|
||||
|
||||
public Rs256Signer() {
|
||||
this(null);
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public Rs256Signer(PrivateKey privateKey) {
|
||||
public Rs256Signer(PublicKey publicKey, PrivateKey privateKey) {
|
||||
super("RS256");
|
||||
|
||||
setPublicKey(publicKey);
|
||||
setPrivateKey(privateKey);
|
||||
|
||||
try {
|
||||
|
@ -96,7 +95,7 @@ public class Rs256Signer extends AbstractJwtSigner {
|
|||
String c64 = parts.get(1);
|
||||
String s64 = parts.get(2);
|
||||
|
||||
String signingInput = h64 + "." + c64 + ".";
|
||||
String signingInput = h64 + "." + c64;
|
||||
|
||||
try {
|
||||
signer.initVerify(publicKey);
|
||||
|
@ -139,4 +138,12 @@ public class Rs256Signer extends AbstractJwtSigner {
|
|||
this.privateKey = privateKey;
|
||||
}
|
||||
|
||||
public PublicKey getPublicKey() {
|
||||
return publicKey;
|
||||
}
|
||||
|
||||
public void setPublicKey(PublicKey publicKey) {
|
||||
this.publicKey = publicKey;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue