<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/security/privateca/v1beta1/resources.proto

namespace Google\Cloud\Security\PrivateCA\V1beta1\PublicKey;

use UnexpectedValueException;

/**
 * Types of public keys that are supported.
 * At a minimum, we support RSA and ECDSA, for the key sizes or curves listed:
 * https://cloud.google.com/kms/docs/algorithms#asymmetric_signing_algorithms
 *
 * Protobuf type <code>google.cloud.security.privateca.v1beta1.PublicKey.KeyType</code>
 */
class KeyType
{
    /**
     * Default unspecified value.
     *
     * Generated from protobuf enum <code>KEY_TYPE_UNSPECIFIED = 0;</code>
     */
    const KEY_TYPE_UNSPECIFIED = 0;
    /**
     * A PEM-encoded PKCS#1/RFC 3447 RSAPrivateKey structure.
     *
     * Generated from protobuf enum <code>PEM_RSA_KEY = 1;</code>
     */
    const PEM_RSA_KEY = 1;
    /**
     * A PEM-encoded compressed NIST P-256/secp256r1/prime256v1 or P-384 key.
     *
     * Generated from protobuf enum <code>PEM_EC_KEY = 2;</code>
     */
    const PEM_EC_KEY = 2;

    private static $valueToName = [
        self::KEY_TYPE_UNSPECIFIED => 'KEY_TYPE_UNSPECIFIED',
        self::PEM_RSA_KEY => 'PEM_RSA_KEY',
        self::PEM_EC_KEY => 'PEM_EC_KEY',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(KeyType::class, \Google\Cloud\Security\PrivateCA\V1beta1\PublicKey_KeyType::class);

