private KeysetHandle loadPrivateKey() throws IOException, GeneralSecurityException { return CleartextKeysetHandle.read(JsonKeysetReader.withFile(new File(PRIVATE_KEYSET_FILENAME))); }
private KeysetHandle loadPublicKey() throws IOException, GeneralSecurityException { return CleartextKeysetHandle.read(JsonKeysetReader.withFile(new File(PUBLIC_KEYSET_FILENAME))); }
private KeysetHandle loadKey() throws IOException, GeneralSecurityException { return CleartextKeysetHandle.read(JsonKeysetReader.withFile(new File(KEYSET_FILENAME))); }
/** * Constructs a new RSA-ECDSA EncrypterManager. * * <p>Please note that the {@link InputStream} {@code senderSigningKey} will not be closed. * * @param senderSigningKey the serialized Tink signing key. * @throws GeneralSecurityException if the initialization fails. * @throws IOException if the given sender signing key cannot be read. */ public RsaEcdsaEncrypterManager(InputStream senderSigningKey) throws GeneralSecurityException, IOException { KeysetHandle signingKeyHandle = CleartextKeysetHandle .read(BinaryKeysetReader.withInputStream(senderSigningKey)); senderSigner = PublicKeySignFactory.getPrimitive(signingKeyHandle); }
/** * Constructs a new RSA-ECDSA EncrypterManager. * * <p>Please note that the {@link InputStream} {@code senderSigningKey} will not be closed. * * @param senderSigningKey the serialized Tink signing key. * @throws GeneralSecurityException if the initialization fails. * @throws IOException if the given sender signing key cannot be read. */ public RsaEcdsaEncrypterManager(InputStream senderSigningKey) throws GeneralSecurityException, IOException { KeysetHandle signingKeyHandle = CleartextKeysetHandle .read(BinaryKeysetReader.withInputStream(senderSigningKey)); senderSigner = PublicKeySignFactory.getPrimitive(signingKeyHandle); }
try { symmetricKeyHandle = CleartextKeysetHandle.read(BinaryKeysetReader.withBytes(symmetricKeyBytes)); } catch (IOException e) { throw new GeneralSecurityException("hybrid rsa decryption failed: ", e);
try { symmetricKeyHandle = CleartextKeysetHandle.read(BinaryKeysetReader.withBytes(symmetricKeyBytes)); } catch (IOException e) { throw new GeneralSecurityException("hybrid rsa decryption failed: ", e);
static PublicKeyVerify createTestSenderVerifier() throws GeneralSecurityException, IOException { KeysetHandle verificationKeyHandle = CleartextKeysetHandle .read(BinaryKeysetReader.withBytes(TestUtils.getBytes("verification_key.dat"))); return PublicKeyVerifyFactory.getPrimitive(verificationKeyHandle); }
static PublicKeySign createTestSenderSigner() throws GeneralSecurityException, IOException { KeysetHandle signingKeyHandle = CleartextKeysetHandle .read(BinaryKeysetReader.withBytes(TestUtils.getBytes("signing_key.dat"))); return PublicKeySignFactory.getPrimitive(signingKeyHandle); }