Saturday, June 6, 2020

Commonly Used Terms and Acronyms

OAEP: In RSA cryptography, OAEP stands for Optimal Asymmetric Encryption Padding, a padding structure often used with RSA encryption. The OAEP algorithm accomplishes two goals:
  • Add an element of randomness which can be used to transform the deterministic encryption (e.g. RSA encryption) to a probabilistic one.
  • Defend against any partial decryption (or other information leakage) attacks against ciphertext by ensuring that the attacker cannot obtain any part of the plaintext without being able to invert the trap door one way permutation. See https://en.wikipedia.org/wiki/Optimal_asymmetric_encryption_padding.
OAEP is a type of Feistel Network.

CAdES-BES: CMS Advanced Electronic Signature - Basic Electronic Signature

PKCS#7:
see: https://boringssl.googlesource.com/boringssl/+/master/include/openssl/pkcs7.h

// Deprecated functions.
//
// These functions are a compatibility layer over a subset of OpenSSL's PKCS#7
// API. It intentionally does not implement the whole thing, only the minimum
// needed to build cryptography.io.

typedef struct {
   STACK_OF(X509) *cert;
   STACK_OF(X509_CRL) *crl;
} PKCS7_SIGNED;

typedef struct {
   STACK_OF(X509) *cert;
   STACK_OF(X509_CRL) *crl;
} PKCS7_SIGN_ENVELOPE;

typedef void PKCS7_ENVELOPE;
typedef void PKCS7_DIGEST;
typedef void PKCS7_ENCRYPT;

typedef struct {
   uint8_t *ber_bytes;
   size_t ber_len;

// Unlike OpenSSL, the following fields are immutable. They filled in when the
// object is parsed and ignored in serialization.
ASN1_OBJECT *type;
  union {
   char *ptr;
   ASN1_OCTET_STRING *data;
   PKCS7_SIGNED *sign;
   PKCS7_ENVELOPE *enveloped;
   PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
   PKCS7_DIGEST *digest;
   PKCS7_ENCRYPT *encrypted;
   ASN1_TYPE *other;
  } d;
} PKCS7;

// d2i_PKCS7 parses a BER-encoded, PKCS#7 signed data ContentInfo structure from
// |len| bytes at |*inp|. If |out| is not NULL then, on exit, a pointer to the
// result is in |*out|. Note that, even if |*out| is already non-NULL on entry,
// it will not be written to. Rather, a fresh |PKCS7| is allocated and the
// previous one is freed. On successful exit, |*inp| is advanced past the BER
// structure. It returns the result or NULL on error.
OPENSSL_EXPORT PKCS7 *d2i_PKCS7(PKCS7 **out, const uint8_t **inp,
size_t len);