Billing.Security.GeneratePublicKey C# (CSharp) 메소드

GeneratePublicKey() 개인적인 정적인 메소드

Generates a PublicKey instance from a string containing the Base64-encoded public key.
if encodedPublicKey is invalid
private static GeneratePublicKey ( string encodedPublicKey ) : IPublicKey
encodedPublicKey string Base64-encoded public key
리턴 IPublicKey
        private static IPublicKey GeneratePublicKey(string encodedPublicKey)
        {
            try
            {
                byte[] decodedKey = Convert.FromBase64String(encodedPublicKey);
                KeyFactory keyFactory = KeyFactory.GetInstance(KEY_FACTORY_ALGORITHM);

                return keyFactory.GeneratePublic(new X509EncodedKeySpec(decodedKey));
            }
            catch (NoSuchAlgorithmException e)
            {
                // This won't happen in an Android-compatible environment.
                throw new RuntimeException(e);
            }
            catch (FormatException e)
            {
                Log.Error(TAG, "Could not decode from Base64.");
                throw e;
            }
            catch (InvalidKeySpecException e)
            {
                Log.Error(TAG, "Invalid key specification.");
                throw new IllegalArgumentException(e);
            }
        }