Package java.security

Examples of java.security.SignatureException


      Admin admin = userAdminSession.getAdmin(signerCert);
      // Check that user have the administrator flag set.
      userAdminSession.checkIfCertificateBelongToUser(admin, signerCert.getSerialNumber(), signerCert.getIssuerDN().toString());
      boolean isRevoked = certificateStoreSession.isRevoked(CertTools.stringToBCDNString(signerCert.getIssuerDN().toString()), signerCert.getSerialNumber());
      if (isRevoked) {
        throw new SignatureException("Error Signer certificate doesn't exist or is revoked.");
      }
      return admin;
    }
    return internalUser;
 
View Full Code Here


             Mac hmacSha1 = Mac.getInstance( "HmacSHA1" );
             hmacSha1.init( key );
            byte [] rawHmac = hmacSha1.doFinal( signIt.getBytes());
            result = new String( Base64.encodeBase64( rawHmac ));
         } catch( Exception e ) {
           throw new SignatureException( "Failed to generate keyed HMAC on soap request: " + e.getMessage());
         }
         return result.trim();
    }
View Full Code Here

          hmacSha1.init( key );
            byte [] rawHmac = hmacSha1.doFinal( signIt.getBytes());
            result = new String( Base64.encodeBase64( rawHmac ));
             }
         catch( InvalidKeyException e ) {
           throw new SignatureException( "Failed to generate keyed HMAC on REST request because key " + secretKey + " is invalid" + e.getMessage());
              }
         catch (Exception e) {
         throw new SignatureException( "Failed to generate keyed HMAC on REST request: " + e.getMessage())
              }
         return result.trim();
    }
View Full Code Here

           hmacShaAlg.init( key );
           byte [] rawHmac = hmacShaAlg.doFinal( signIt.getBytes());
            result = new String( Base64.encodeBase64( rawHmac ));
           
         } catch( Exception e ) {
           throw new SignatureException( "Failed to generate keyed HMAC on REST request: " + e.getMessage());
         }
         return result.trim();
    }
View Full Code Here

            if (sigBytes[offset + 0] != 0x30 || sigBytes[offset + 2] != 2
                    || sigBytes[offset + n1 + 4] != 2
                    || sigBytes[offset + 1] != (n1 + n2 + 4) || n1 > 21
                    || n2 > 21
                    || (length != 0 && (sigBytes[offset + 1] + 2) > length)) {
                throw new SignatureException(Messages.getString("security.16F")); //$NON-NLS-1$
            }

            dummy = sigBytes[5 + n1 + n2]; // to check length of sigBytes
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new SignatureException(Messages.getString("security.170")); //$NON-NLS-1$
        }

        digest = msgDigest.digest();

        bytes = new byte[n1];
View Full Code Here

        Signature signature = Signature.getInstance(getSigAlgName());
        signature.initVerify(key);
        byte[] tbsEncoding = tbsCertList.getEncoded();
        signature.update(tbsEncoding, 0, tbsEncoding.length);
        if (!signature.verify(crl.getSignatureValue())) {
            throw new SignatureException(Messages.getString("security.15C")); //$NON-NLS-1$
        }
    }
View Full Code Here

                                            getSigAlgName(), sigProvider);
        signature.initVerify(key);
        byte[] tbsEncoding = tbsCertList.getEncoded();
        signature.update(tbsEncoding, 0, tbsEncoding.length);
        if (!signature.verify(crl.getSignatureValue())) {
            throw new SignatureException(Messages.getString("security.15C")); //$NON-NLS-1$
        }
    }
View Full Code Here

            tbsCertificate = tbsCert.getEncoded();
        }
        // compute and verify the signature
        signature.update(tbsCertificate, 0, tbsCertificate.length);
        if (!signature.verify(certificate.getSignatureValue())) {
            throw new SignatureException(Messages.getString("security.15C")); //$NON-NLS-1$
        }
    }
View Full Code Here

            tbsCertificate = tbsCert.getEncoded();
        }
        // compute and verify the signature
        signature.update(tbsCertificate, 0, tbsCertificate.length);
        if (!signature.verify(certificate.getSignatureValue())) {
            throw new SignatureException(Messages.getString("security.15C")); //$NON-NLS-1$
        }
    }
View Full Code Here

        sig.initVerify(key);
        sig.update(this.getTBSCertList());
        if (!sig.verify(this.getSignature()))
        {
            throw new SignatureException("CRL does not verify with supplied public key.");
        }
    }
View Full Code Here

TOP

Related Classes of java.security.SignatureException

Copyright © 2018 www.massapicom. 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.