@Test public void validateKey_generated() throws Exception { if (TestUtil.isTsan()) { return; } RsaSsaPssKeyFormat keyFormat = RsaSsaPssKeyFormat.newBuilder() .setParams( RsaSsaPssParams.newBuilder() .setSigHash(HashType.SHA256) .setMgf1Hash(HashType.SHA256) .setSaltLength(32)) .setModulusSizeInBits(3072) .setPublicExponent(ByteString.copyFrom(RSAKeyGenParameterSpec.F4.toByteArray())) .build(); RsaSsaPssPrivateKey privateKey = factory.createKey(keyFormat); RsaSsaPssPublicKey publicKey = signManager.getPublicKey(privateKey); verifyManager.validateKey(publicKey); }
@Override public void validateKey(RsaSsaPssPublicKey pubKey) throws GeneralSecurityException { Validators.validateVersion(pubKey.getVersion(), getVersion()); Validators.validateRsaModulusSize(new BigInteger(1, pubKey.getN().toByteArray()).bitLength()); Validators.validateRsaPublicExponent(new BigInteger(1, pubKey.getE().toByteArray())); SigUtil.validateRsaSsaPssParams(pubKey.getParams()); }
RsaSsaPssVerifyKeyManager extends KeyTypeManager<RsaSsaPssPublicKey> { @Override public void validateKey(RsaSsaPssPublicKey pubKey) throws GeneralSecurityException { Validators.validateVersion(pubKey.getVersion(), getVersion()); Validators.validateRsaModulusSize(new BigInteger(1, pubKey.getN().toByteArray()).bitLength()); Validators.validateRsaPublicExponent(new BigInteger(1, pubKey.getE().toByteArray())); SigUtil.validateRsaSsaPssParams(pubKey.getParams()); } }
RsaSsaPssVerifyKeyManager extends KeyTypeManager<RsaSsaPssPublicKey> { @Override public void validateKey(RsaSsaPssPublicKey pubKey) throws GeneralSecurityException { Validators.validateVersion(pubKey.getVersion(), getVersion()); Validators.validateRsaModulusSize(new BigInteger(1, pubKey.getN().toByteArray()).bitLength()); Validators.validateRsaPublicExponent(new BigInteger(1, pubKey.getE().toByteArray())); SigUtil.validateRsaSsaPssParams(pubKey.getParams()); } RsaSsaPssVerifyKeyManager(); }
RsaSsaPssVerifyKeyManager extends KeyTypeManager<RsaSsaPssPublicKey> { @Override public void validateKey(RsaSsaPssPublicKey pubKey) throws GeneralSecurityException { Validators.validateVersion(pubKey.getVersion(), getVersion()); Validators.validateRsaModulusSize(new BigInteger(1, pubKey.getN().toByteArray()).bitLength()); Validators.validateRsaPublicExponent(new BigInteger(1, pubKey.getE().toByteArray())); SigUtil.validateRsaSsaPssParams(pubKey.getParams()); } RsaSsaPssVerifyKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override RsaSsaPssPublicKey parseKey(ByteString byteString); @Override void validateKey(RsaSsaPssPublicKey pubKey); }
RsaSsaPssVerifyKeyManager extends KeyTypeManager<RsaSsaPssPublicKey> { @Override public void validateKey(RsaSsaPssPublicKey pubKey) throws GeneralSecurityException { Validators.validateVersion(pubKey.getVersion(), getVersion()); Validators.validateRsaModulusSize(new BigInteger(1, pubKey.getN().toByteArray()).bitLength()); Validators.validateRsaPublicExponent(new BigInteger(1, pubKey.getE().toByteArray())); SigUtil.validateRsaSsaPssParams(pubKey.getParams()); } RsaSsaPssVerifyKeyManager(); @Override String getKeyType(); @Override int getVersion(); @Override KeyMaterialType keyMaterialType(); @Override RsaSsaPssPublicKey parseKey(ByteString byteString); @Override void validateKey(RsaSsaPssPublicKey pubKey);  }