예제 #1
0
    protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException {
      if (keySpec instanceof X509EncodedKeySpec) {
        try {
          return JDKKeyFactory.createPublicKeyFromDERStream(
              ((X509EncodedKeySpec) keySpec).getEncoded());
        } catch (Exception e) {
          throw new InvalidKeySpecException(e.toString());
        }
      }

      throw new InvalidKeySpecException("Unknown KeySpec type: " + keySpec.getClass().getName());
    }
예제 #2
0
    protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException {
      if (keySpec instanceof X509EncodedKeySpec) {
        try {
          return JDKKeyFactory.createPublicKeyFromDERStream(
              ((X509EncodedKeySpec) keySpec).getEncoded());
        } catch (Exception e) {
          throw new InvalidKeySpecException(e.toString());
        }
      }
      // BEGIN android-removed
      // else if (keySpec instanceof GOST3410PublicKeySpec)
      // {
      //     return new JDKGOST3410PublicKey((GOST3410PublicKeySpec)keySpec);
      // }
      // END android-removed

      throw new InvalidKeySpecException("Unknown KeySpec type: " + keySpec.getClass().getName());
    }