# 1
···
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
byte[] encodeByte = Base64.getDecoder().decode(privateKeyString);
RSAPrivateKey privateKey = (RSAPrivateKey) keyFactory.generatePrivate(parsePKCS1( encodeByte ) );
Algorithm algorithm = Algorithm.RSA256(null, privateKey );
···
```
private static RSAPrivateCrtKeySpecparsePKCS1(byte[] source) {
Asn1Parser p =new Asn1Parser(source);
// https://en.wikipedia.org/wiki/X.690#BER_encoding
// https://tools.ietf.org/html/rfc8017#page-55
// Type (sequence)
p.parseTag(0x30);
// Length
p.parseFullLength();
BigInteger version = p.parseInt();
if (version.intValue() ==1) {
// JRE doesn't provide a suitable constructor for multi-prime
// keys
log.error("parse error" );
}
return new RSAPrivateCrtKeySpec(p.parseInt(), p.parseInt(), p.parseInt(), p.parseInt(),
p.parseInt(), p.parseInt(), p.parseInt(), p.parseInt());
}
```