Show / Hide Table of Contents

Class EncryptionTactic

EncryptionTactics define the various formats that the Smartcrypt Protocol uses to encode information about ciphertexts, salts, keys, and other cryptographic parameters.

Inheritance
Object
EncryptionTactic
Implements
IEquatable<EncryptionTactic>
Inherited Members
Object.Equals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Namespace: PKWARE.Smartcrypt.Protocol
Assembly: SmartcryptProtocol.dll
Syntax
public sealed class EncryptionTactic : IEquatable<EncryptionTactic>
Remarks

The presence of a prefix matching an encryption tactic does not guarantee that the content is encrypted. The prefixes, commonly something like V2 may be used for other purposes as well. Be aware of this when writing algorithms.

Fields

V2

RSA encryption.

Declaration
public static readonly EncryptionTactic V2
Field Value
Type Description
EncryptionTactic
Remarks

Given a plaintext plain, the final format will be V2-base64(RSA_encrypt(plain)).

V3

AES encryption of an AES key. Used for providing contingency access to asset keys.

Declaration
public static readonly EncryptionTactic V3
Field Value
Type Description
EncryptionTactic
Remarks

Given a plaintext plain, the final format will be V3-key_sequence-base64(iv)-base64(AES_encrypt(plain)). plain must be 32 bytes. The IV must be 16 bytes. AES encryption must be performed without padding.

V4

AES encryption with a one-time key.

Declaration
public static readonly EncryptionTactic V4
Field Value
Type Description
EncryptionTactic
Remarks

Given a plaintext plain, the final format will be V4-base64(AES_encrypt(plain)). A new, one-time use, 32 byte AES key is generated for this encryption. The IV is the first 16 bytes of the AES key.

Commonly, the V4 tactic is used in conjunction with V2 as a form of hybrid encryption.

V5

AES encryption without padding.

Declaration
public static readonly EncryptionTactic V5
Field Value
Type Description
EncryptionTactic
Remarks

Intended for general use encryption. The AES key is derived from the user's password using PBKDF2. Given a plaintext plain, the final format will be V5-base64(iv)-base64(AES_encrypt(plain)). The AES encryption must not use padding. The IV is a randomly generated 16 bytes.

See Also
V6

V6

AES encryption with padding.

Declaration
public static readonly EncryptionTactic V6
Field Value
Type Description
EncryptionTactic
Remarks

Intended for general use encryption. The AES key is derived from the user's password using PBKDF2. Given a plaintext plain, the final format will be V6-base64(iv)-base64(AES_encrypt(plain)). The AES encryption must use padding. The IV is a randomly generated 16 bytes.

See Also
V5

V7

AES encryption of a user-supplied password.

Declaration
public static readonly EncryptionTactic V7
Field Value
Type Description
EncryptionTactic
Remarks

Given a plaintext plain, the final format will be V7-hex(iv)hex(AES_encrypt(plain)). The user-supplied password must be at least 32 byes long. If it is not, it must be padded with NUL characters to be 32 bytes long. The IV is a randomly generated 16 bytes. The AES encryption must use padding.

Methods

ApplyPrefix(String)

Prepends this tactic's prefix to the content.

Declaration
[Pure]
[NotNull]
public string ApplyPrefix([CanBeNull] string value)
Parameters
Type Name Description
String value

The content to prepend the prefix to.

Returns
Type Description
String

The content with the prefix applied.

Equals(EncryptionTactic)

Declaration
public bool Equals(EncryptionTactic other)
Parameters
Type Name Description
EncryptionTactic other
Returns
Type Description
Boolean

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean
Overrides
Object.Equals(Object)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32
Overrides
Object.GetHashCode()

IsCompatible(String)

Checks whether or not content is compatible with this tactic.

Declaration
[Pure]
public bool IsCompatible([NotNull] string value)
Parameters
Type Name Description
String value

The content to check for compatibility.

Returns
Type Description
Boolean

true if the value starts with this tactic's prefix, otherwise false.

StripPrefix(String)

Removes this tactic's prefix from the content if it exists.

Declaration
[Pure]
[NotNull]
public string StripPrefix([NotNull] string value)
Parameters
Type Name Description
String value

The content from which to remove the prefix. Does not have to have the prefix.

Returns
Type Description
String

The value without the prefix.

ToString()

Declaration
public override string ToString()
Returns
Type Description
String
Overrides
Object.ToString()

Implements

System.IEquatable<T>

See Also

SmartcryptCrypto
EncryptionPurpose
Back to top Copyright © 2018 PKWARE, Inc.