private KeysetHandle generateKey() throws GeneralSecurityException { return KeysetHandle.generateNew(MacKeyTemplates.HMAC_SHA256_128BITTAG); } }
private KeysetHandle generatePrivateKey() throws GeneralSecurityException { return KeysetHandle.generateNew(HybridKeyTemplates.ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM); }
private KeysetHandle generateKey() throws GeneralSecurityException { return KeysetHandle.generateNew(AeadKeyTemplates.AES128_GCM); }
private KeysetHandle generatePrivateKey() throws GeneralSecurityException { return KeysetHandle.generateNew(HybridKeyTemplates.ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM); }
private KeysetHandle generatePrivateKey() throws GeneralSecurityException { return KeysetHandle.generateNew(SignatureKeyTemplates.ECDSA_P256); }
/** * Stores the keyset in the projects resources/keysets directory if it does not exist yet. * * @throws IOException Failure during saving * @throws GeneralSecurityException Failure during keyset generation */ private void generateAndStoreKey() throws IOException, GeneralSecurityException { KeysetHandle keysetHandle = KeysetHandle.generateNew(AeadKeyTemplates.AES128_GCM); File keysetFile = new File(KEYSET_FILENAME); if (!keysetFile.exists()) { CleartextKeysetHandle.write(keysetHandle, JsonKeysetWriter.withFile(keysetFile)); } }
/** * Stores the private keyset in the projects resources/keysets directory if it does not exist yet. * * @throws IOException Failure during saving * @throws GeneralSecurityException Failure during keyset generation */ private void generateAndStorePrivateKey() throws IOException, GeneralSecurityException { KeysetHandle keysetHandle = KeysetHandle.generateNew(HybridKeyTemplates.ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM); File keysetFile = new File(PRIVATE_KEYSET_FILENAME); if (!keysetFile.exists()) { CleartextKeysetHandle.write(keysetHandle, JsonKeysetWriter.withFile(keysetFile)); } }
KeysetHandle symmetricKeyHandle = KeysetHandle.generateNew(SYMMETRIC_KEY_TEMPLATE); ByteArrayOutputStream symmetricKeyOutputStream = new ByteArrayOutputStream(); try {
KeysetHandle symmetricKeyHandle = KeysetHandle.generateNew(SYMMETRIC_KEY_TEMPLATE); ByteArrayOutputStream symmetricKeyOutputStream = new ByteArrayOutputStream(); try {
private static void generateEcdsaKeyPair(File publicKeyFile, File privatekeyFile) throws GeneralSecurityException, IOException { KeysetHandle privateKeyHandle = KeysetHandle.generateNew(SIGNATURE_KEY_TEMPLATE); CleartextKeysetHandle.write(privateKeyHandle, BinaryKeysetWriter.withFile(privatekeyFile)); KeysetHandle publicKeyHandle = privateKeyHandle.getPublicKeysetHandle(); CleartextKeysetHandle.write(publicKeyHandle, BinaryKeysetWriter.withFile(publicKeyFile)); } }