Examples of RSAPadding


Examples of org.keyczar.enums.RsaPadding

      assertTrue(e.getCause() instanceof BadPaddingException);
    }
  }

  private void doTestSignImport(String keyType, InputStream pkcs8KeyStream) throws Exception {
    RsaPadding padding = RsaPadding.OAEP;
    if (keyType.equals("dsa")) {
      padding = null;
    }

    final String signature = new Signer(TEST_DATA + keyType + "-sign").sign(INPUT);
View Full Code Here

Examples of org.keyczar.enums.RsaPadding

  }

  private void doTestSignImport(String keyType, String fileFormat) throws Exception {
    String signature = new Signer(TEST_DATA + keyType + "-sign").sign(input);

    RsaPadding padding = null;
    if ("rsa".equals(keyType)) {
      padding = RsaPadding.OAEP;
    }

    Verifier verifier =
View Full Code Here

Examples of org.keyczar.enums.RsaPadding

    updateGenericKeyczar(destinationKeyczar, crypterFlag, locationFlag);
  }

  private static GenericKeyczar getImportingKeyczar(String pemFileFlag, String paddingFlag,
      String passphraseFlag, final KeyPurpose purpose) throws KeyczarException, IOException {
    RsaPadding padding = getPadding(paddingFlag);
    InputStream fileStream = getFileStream(pemFileFlag);
    try {
      return new GenericKeyczar(new X509CertificateReader(purpose, fileStream, padding));
    } catch (KeyczarException e) {
      if (e.getCause() instanceof CertificateException) {
View Full Code Here

Examples of org.keyczar.enums.RsaPadding

    genericKeyczar.addVersion(statusFlag, keyParams);
    updateGenericKeyczar(genericKeyczar, crypterFlag, locationFlag);
  }

  private static RsaPadding getPadding(String paddingFlag) throws KeyczarException {
    RsaPadding padding = null;
    if (paddingFlag != null) {
      try {
        padding = RsaPadding.valueOf(paddingFlag.toUpperCase());
      } catch (IllegalArgumentException e) {
        throw new KeyczarException(Messages.getString("InvalidPadding", paddingFlag));
View Full Code Here

Examples of sun.security.rsa.RSAPadding

            }
        }
    }

    private void checkRSAKeyLength(int len) throws InvalidKeyException {
        RSAPadding padding;
        try {
            padding = RSAPadding.getInstance
                (RSAPadding.PAD_BLOCKTYPE_1, (len + 7) >> 3);
        } catch (InvalidAlgorithmParameterException iape) {
            throw new InvalidKeyException(iape.getMessage());
        }
        int maxDataSize = padding.getMaxDataSize();
        int encodedLength;
        if (algorithm.equals("MD5withRSA") ||
            algorithm.equals("MD2withRSA")) {
            encodedLength = 34;
        } else if (algorithm.equals("SHA1withRSA")) {
View Full Code Here

Examples of sun.security.rsa.RSAPadding

    }

    private byte[] pkcs1Pad(byte[] data) {
        try {
            int len = (p11Key.length() + 7) >> 3;
            RSAPadding padding = RSAPadding.getInstance
                                        (RSAPadding.PAD_BLOCKTYPE_1, len);
            byte[] padded = padding.pad(data);
            return padded;
        } catch (GeneralSecurityException e) {
            throw new ProviderException(e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.