Examples of Base32


Examples of org.apache.commons.codec.binary.Base32

            String secret,
            long code,
            long tm,
            int window) {
        // Decoding the secret key to get its raw byte representation.
        Base32 codec = new Base32();
        byte[] decodedKey = codec.decode(secret);

        // convert unix time into a 30 second "window" as specified by the
        // TOTP specification. Using Google's default interval of 30 seconds.
        final long timeWindow = tm / KEY_VALIDATION_INTERVAL_MS;
View Full Code Here

Examples of org.apache.commons.codec.binary.Base32

     *
     * @param secretKey a random byte buffer.
     * @return the secret key.
     */
    private String calculateSecretKey(byte[] secretKey) {
        Base32 codec = new Base32();
        byte[] encodedKey = codec.encode(secretKey);

        // Creating a string with the Base32 encoded bytes.
        return new String(encodedKey);
    }
View Full Code Here

Examples of org.apache.commons.codec.binary.Base32

      dsa.update(stringData.getBytes("UTF-8"));
     
      final byte[] signed = dsa.sign();
     
      /* base 32 encode the signature */
      String result = new Base32().encodeAsString(signed);
     
      /* replace O with 8 and I with 9 */
      result = result.replace("O", "8").replace("I""9");
     
      /* remove padding if any. */
 
View Full Code Here

Examples of org.apache.commons.codec.binary.Base32

    /* Pad the output length to a multiple of 8 with '=' characters */
    while (licenseSignature.length() % 8 != 0) {
      licenseSignature += "=";
    }
   
    byte[] decoded = new Base32().decode(licenseSignature);
    try {
      Signature dsa = Signature.getInstance("SHA1withDSA", "SUN");
      dsa.initVerify(publicKey);
      dsa.update(stringData.getBytes("UTF-8"));
      return dsa.verify(decoded);
View Full Code Here

Examples of org.jwat.common.Base32

        String base16sa;
        String base16ss;
        String base16da;
        String base16ds;

        Base32 b32 = new Base32();
        Assert.assertNotNull(b32);

        base32a = Base32.encodeArray( null );
        Assert.assertNull( base32a );
        base32a = Base32.encodeArray( new byte[ 0 ] );
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.