private Map createMaterialItem()

in DynamoDbEncryption/runtimes/java/src/main/sdkv1/com/amazonaws/services/dynamodbv2/datamodeling/encryption/providers/store/MetaStore.java [404:446]


  private Map<String, AttributeValue> createMaterialItem(
    final String materialName,
    final long version
  ) {
    final SecretKeySpec encryptionKey = new SecretKeySpec(
      Utils.getRandom(32),
      DEFAULT_ENCRYPTION
    );
    final SecretKeySpec integrityKey = new SecretKeySpec(
      Utils.getRandom(32),
      DEFAULT_INTEGRITY
    );

    final Map<String, AttributeValue> plaintext = new HashMap<
      String,
      AttributeValue
    >();
    plaintext.put(DEFAULT_HASH_KEY, new AttributeValue().withS(materialName));
    plaintext.put(
      DEFAULT_RANGE_KEY,
      new AttributeValue().withN(Long.toString(version))
    );
    plaintext.put(MATERIAL_TYPE_VERSION, new AttributeValue().withS("0"));
    plaintext.put(
      ENCRYPTION_KEY_FIELD,
      new AttributeValue().withB(ByteBuffer.wrap(encryptionKey.getEncoded()))
    );
    plaintext.put(
      ENCRYPTION_ALGORITHM_FIELD,
      new AttributeValue().withS(encryptionKey.getAlgorithm())
    );
    plaintext.put(
      INTEGRITY_KEY_FIELD,
      new AttributeValue().withB(ByteBuffer.wrap(integrityKey.getEncoded()))
    );
    plaintext.put(
      INTEGRITY_ALGORITHM_FIELD,
      new AttributeValue().withS(integrityKey.getAlgorithm())
    );
    plaintext.putAll(extraDataSupplier.getAttributes(materialName, version));

    return plaintext;
  }