@Test public void createPrimitive() throws Exception { if (TestUtil.isTsan()) { return; } RsaSsaPssKeyFormat format = createKeyFormat(HashType.SHA512, HashType.SHA512, 64, 4096, RSAKeyGenParameterSpec.F4); RsaSsaPssPrivateKey key = factory.createKey(format); PublicKeySign signer = manager.getPrimitive(key, PublicKeySign.class); KeyFactory kf = EngineFactory.KEY_FACTORY.getInstance("RSA"); BigInteger modulus = new BigInteger(1, key.getPublicKey().getN().toByteArray()); BigInteger exponent = new BigInteger(1, key.getPublicKey().getE().toByteArray()); RSAPublicKey publicKey = (RSAPublicKey) kf.generatePublic(new RSAPublicKeySpec(modulus, exponent)); RsaSsaPssParams params = key.getPublicKey().getParams(); PublicKeyVerify verifier = new RsaSsaPssVerifyJce( publicKey, SigUtil.toHashType(params.getSigHash()), SigUtil.toHashType(params.getMgf1Hash()), params.getSaltLength()); byte[] message = Random.randBytes(135); verifier.verify(signer.sign(message), message); }
@Override public RsaSsaPssPublicKey getPublicKey(RsaSsaPssPrivateKey privKeyProto) throws GeneralSecurityException { return privKeyProto.getPublicKey(); }
RsaSsaPssSignKeyManager extends PrivateKeyTypeManager<RsaSsaPssPrivateKey, RsaSsaPssPublicKey> { @Override public RsaSsaPssPublicKey getPublicKey(RsaSsaPssPrivateKey privKeyProto) throws GeneralSecurityException { return privKeyProto.getPublicKey(); } }
RsaSsaPssSignKeyManager extends PrivateKeyTypeManager<RsaSsaPssPrivateKey, RsaSsaPssPublicKey> { @Override public RsaSsaPssPublicKey getPublicKey(RsaSsaPssPrivateKey privKeyProto) throws GeneralSecurityException { return privKeyProto.getPublicKey(); } RsaSsaPssSignKeyManager(); }
RsaSsaPssSignKeyManager extends PrivateKeyTypeManager<RsaSsaPssPrivateKey, RsaSsaPssPublicKey> { @Override public RsaSsaPssPublicKey getPublicKey(RsaSsaPssPrivateKey privKeyProto) throws GeneralSecurityException { return privKeyProto.getPublicKey(); } RsaSsaPssSignKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override RsaSsaPssPublicKey getPublicKey(RsaSsaPssPrivateKey privKeyProto); @Override KeyMaterialType keyMaterialType(); @Override RsaSsaPssPrivateKey parseKey(ByteString byteString); @Override void validateKey(RsaSsaPssPrivateKey keyProto); @Override KeyFactory<RsaSsaPssKeyFormat, RsaSsaPssPrivateKey> keyFactory(); static void registerPair(boolean newKeyAllowed); static final KeyTemplate rsa3072PssSha256F4Template(); static final KeyTemplate rawRsa3072PssSha256F4Template(); static final KeyTemplate rsa4096PssSha512F4Template(); static final KeyTemplate rawRsa4096PssSha512F4Template(); }
RsaSsaPssSignKeyManager extends PrivateKeyTypeManager<RsaSsaPssPrivateKey, RsaSsaPssPublicKey> { @Override public RsaSsaPssPublicKey getPublicKey(RsaSsaPssPrivateKey privKeyProto) throws GeneralSecurityException { return privKeyProto.getPublicKey(); } RsaSsaPssSignKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override RsaSsaPssPublicKey getPublicKey(RsaSsaPssPrivateKey privKeyProto); @Override KeyMaterialType keyMaterialType(); @Override RsaSsaPssPrivateKey parseKey(ByteString byteString); @Override void validateKey(RsaSsaPssPrivateKey keyProto); @Override KeyFactory<RsaSsaPssKeyFormat, RsaSsaPssPrivateKey> keyFactory(); static void registerPair(boolean newKeyAllowed); static final KeyTemplate rsa3072PssSha256F4Template(); static final KeyTemplate rawRsa3072PssSha256F4Template(); static final KeyTemplate rsa4096PssSha512F4Template(); static final KeyTemplate rawRsa4096PssSha512F4Template();  }