Show / Hide Table of Contents

RsaFormat Class

Namespace: Yubico.YubiKey.Cryptography Assembly: Yubico.YubiKey.dll

This class contains methods that can build and read data formatted for RSA sign/verify and encryption/decryption operations.

C#
public static class RsaFormat
Inheritance object RsaFormat

Remarks

Currently this class will format data into only PKCS #1 v1.5 and PKCS #1 v.2 PSS and OAEP constructions. Furthermore, this class will only build specific subsets of PSS and OAEP.

Note that there are attacks on RSA decryption unpadding operations. To learn more about these attacks, whether the YubiKey is vulnerable, and mitigations, see the User's Manual entry on the topic.

Fields

Name Description
KeySizeBits1024

Use this value to indicate the key size, in bits, is 1024. The KeySizeBits values listed in this class are the sizes supported and provided as a convenience to the user to verify the supported sizes.

KeySizeBits2048

Use this value to indicate the key size, in bits, is 2048. The KeySizeBits values listed in this class are the sizes supported and provided as a convenience to the user to verify the supported sizes.

KeySizeBits3072

Use this value to indicate the key size, in bits, is 3072. The KeySizeBits values listed in this class are the sizes supported and provided as a convenience to the user to verify the supported sizes.

KeySizeBits4096

Use this value to indicate the key size, in bits, is 4096. The KeySizeBits values listed in this class are the sizes supported and provided as a convenience to the user to verify the supported sizes.

Sha1

Use this value to indicate the digest algorithm is SHA-1.

Sha256

Use this value to indicate the digest algorithm is SHA-256.

Sha384

Use this value to indicate the digest algorithm is SHA-384.

Sha512

Use this value to indicate the digest algorithm is SHA-512.

Methods

Name Description
FormatPkcs1Encrypt(ReadOnlySpan<byte>, int)

Build the input data into a PKCS #1 v1.5 formatted block for encryption (see RFC 8017).

FormatPkcs1Oaep(ReadOnlySpan<byte>, int, int)

Build the input data into a PKCS #1 v2 OAEP formatted block for encryption (see RFC 8017).

FormatPkcs1Pss(ReadOnlySpan<byte>, int, int)

Build the digest into a PKCS #1 v2 PSS formatted block for signing (see RFC 8017).

FormatPkcs1Sign(ReadOnlySpan<byte>, int, int)

Build the digest into a PKCS #1 v1.5 formatted block for signing (see RFC 8017).

TryParsePkcs1Decrypt(ReadOnlySpan<byte>, out byte[])

Try to parse the formattedData as a PKCS #1 v1.5 block that was the result of decryption (see RFC 8017).

TryParsePkcs1Oaep(ReadOnlySpan<byte>, int, out byte[])

Try to parse the formattedData as a PKCS #1 v2 OAEP block that was the result of decryption (see RFC 8017).

TryParsePkcs1Pss(ReadOnlySpan<byte>, ReadOnlySpan<byte>, int, out byte[], out bool)

Try to parse the formattedSignature as a PKCS #1 v2 PSS block for verifying (see RFC 8017).

TryParsePkcs1Verify(ReadOnlySpan<byte>, out int, out byte[])

Try to parse the formattedSignature as a PKCS #1 v1.5 block for verifying (see RFC 8017).

In this article
Back to top Generated by DocFX