- Timestamp:
- Jul 13, 2017 3:53:00 PM (4 years ago)
- Branches:
- master
- Children:
- d4a139f2
- Parents:
- 5ddb4ed
- Location:
- core/java/src/net/i2p/crypto
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
core/java/src/net/i2p/crypto/SigUtil.java
r5ddb4ed r0b85bff 18 18 import java.security.interfaces.ECPublicKey; 19 19 import java.security.interfaces.RSAPrivateKey; 20 import java.security.interfaces.RSAPrivateCrtKey; 20 21 import java.security.interfaces.RSAPublicKey; 21 22 import java.security.spec.AlgorithmParameterSpec; … … 445 446 446 447 /** 447 * 448 * As of 0.9.31, if pk is a RSASigningPrivateCrtKey, 449 * this will return a RSAPrivateCrtKey. 448 450 */ 449 451 public static RSAPrivateKey toJavaRSAKey(SigningPrivateKey pk) 450 452 throws GeneralSecurityException { 453 if (pk instanceof RSASigningPrivateCrtKey) 454 return ((RSASigningPrivateCrtKey) pk).toJavaKey(); 451 455 KeyFactory kf = KeyFactory.getInstance("RSA"); 452 456 // private key is modulus (pubkey) + exponent … … 469 473 470 474 /** 471 * @deprecated unused 475 * As of 0.9.31, if pk is a RSAPrivateCrtKey, 476 * this will return a RSASigningPrivateCrtKey. 472 477 */ 473 478 public static SigningPrivateKey fromJavaKey(RSAPrivateKey pk, SigType type) … … 477 482 BigInteger d = pk.getPrivateExponent(); 478 483 byte[] b = combine(n, d, type.getPrivkeyLen()); 484 if (pk instanceof RSAPrivateCrtKey) 485 return RSASigningPrivateCrtKey.fromJavaKey((RSAPrivateCrtKey) pk); 479 486 return new SigningPrivateKey(type, b); 480 487 } … … 570 577 * Combine two BigIntegers of nominal length = len / 2 571 578 * @return array of exactly len bytes 572 * @since 0.9.9 573 */ 574 privatestatic byte[] combine(BigInteger x, BigInteger y, int len)579 * @since 0.9.9, package private since 0.9.31 580 */ 581 static byte[] combine(BigInteger x, BigInteger y, int len) 575 582 throws InvalidKeyException { 576 583 if ((len & 0x01) != 0)
Note: See TracChangeset
for help on using the changeset viewer.