### Classes and interfaces

# Crypt_RSA¶

Pure-PHP PKCS#1 compliant implementation of RSA.

« More »

### Constants

## ASN1 Integer

    CRYPT_RSA_ASN1_INTEGER

## ASN1 Sequence (with the constucted bit set)

    CRYPT_RSA_ASN1_SEQUENCE

## CRYPT_RSA_COMMENT

    CRYPT_RSA_COMMENT

## Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding} (OAEP) for encryption / decryption.

    CRYPT_RSA_ENCRYPTION_OAEP

Uses sha1 by default.

see | \global\Crypt_RSA::setHash()
see | \global\Crypt_RSA::setMGFHash()

## Use PKCS#1 padding.

    CRYPT_RSA_ENCRYPTION_PKCS1

Although CRYPT_RSA_ENCRYPTION_OAEP offers more security, including PKCS#1 padding is necessary for purposes of backwards compatability with protocols (like SSH-1) written before OAEP's introduction.

## CRYPT_RSA_EXPONENT

    CRYPT_RSA_EXPONENT

## CRYPT_RSA_MODE

    CRYPT_RSA_MODE

## To use the pure-PHP implementation

    CRYPT_RSA_MODE_INTERNAL

## To use the OpenSSL library

    CRYPT_RSA_MODE_OPENSSL

(if enabled; otherwise, the internal implementation will be used)

## PKCS#1 formatted private key

    CRYPT_RSA_PRIVATE_FORMAT_PKCS1

Used by OpenSSH

## PuTTY formatted private key

    CRYPT_RSA_PRIVATE_FORMAT_PUTTY

## XML formatted private key

    CRYPT_RSA_PRIVATE_FORMAT_XML

## OpenSSH formatted public key

    CRYPT_RSA_PUBLIC_FORMAT_OPENSSH

Place in $HOME/.ssh/authorized_keys

## PKCS#1 formatted public key

    CRYPT_RSA_PUBLIC_FORMAT_PKCS1

## Raw public key

    CRYPT_RSA_PUBLIC_FORMAT_RAW

An array containing two Math_BigInteger objects.

The exponent can be indexed with any of the following:

0, e, exponent, publicExponent

The modulus can be indexed with any of the following:

1, n, modulo, modulus

## XML formatted public key

    CRYPT_RSA_PUBLIC_FORMAT_XML

## Use the PKCS#1 scheme by default.

    CRYPT_RSA_SIGNATURE_PKCS1

Although CRYPT_RSA_SIGNATURE_PSS offers more security, including PKCS#1 signing is necessary for purposes of backwards compatability with protocols (like SSH-2) written before PSS's introduction.

## Use the Probabilistic Signature Scheme for signing

    CRYPT_RSA_SIGNATURE_PSS

Uses sha1 by default.

see | \global\Crypt_RSA::setSaltLength()
see | \global\Crypt_RSA::setMGFHash()

## CRYPT_RSA_SMALLEST_PRIME

    CRYPT_RSA_SMALLEST_PRIME