Signature toByteArray - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Signature toByteArray method.

This code example shows how to use the following methods:toByteArray
 
    private ContentValues createConsumer(String packageName, long regId, Signature sig,
            boolean isPublic) {
        ContentValues value = new ContentValues();
        value.put(Consumers.PACKAGE_NAME, packageName);
        value.put(Consumers.SIGNATURE, sig.toByteArray());
        value.put(Consumers.IS_SERVICE_PUBLIC, isPublic);
        value.put(Consumers.IS_BANNED, false);
        value.put(Consumers.OWNS_CONSUMER_KEY, true);
        value.put(Consumers.REGISTRY_ID, regId);
        return value;
    } 
 
    private void standardInsert() { 
        long[] ids = new long[6];
        ids[0] = mDB.insert("registry", "", createReg("test1"));
        ids[1] = mDB.insert("registry", "", createReg("test2"));
        ids[2] = mDB.insert("registry", "", createRegAuth("test3"));
        ids[3] = mDB.insert("registry", "", createRegAuth("test4"));
        ids[4] = mDB.insert("registry", "", createRegAuth("test5"));

7
CodeRank
This code example shows how to use the following methods:toByteArray
    try { 
      md = MessageDigest.getInstance("SHA1");
    } catch (NoSuchAlgorithmException e) {
      return ""; 
    } 
    md.update(sig.toByteArray());
    return toHexString(md.digest());
  } 
 
  public static String getUserAgent(Context context) {
    PackageInfo pinfo;
    try { 
      pinfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
    } catch (NameNotFoundException e) {
      pinfo = null;
    } 
 
    final String versionName;
    final int versionCode;
    if (pinfo != null) {
5
CodeRank
This code example shows how to use the following methods:toByteArray
        } 
        return false; 
    } 
 
    private X509Certificate toX509Certificate(Signature signature) throws CertificateException {
        byte[] cert = signature.toByteArray();
        InputStream input = new ByteArrayInputStream(cert);
        return (X509Certificate)this.certificateFactory.generateCertificate(input);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:toByteArray
        try 
        { 
            final PackageManager manager = context.getPackageManager();
            final PackageInfo info = manager.getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
            final Signature signature = info.signatures[0];
            return signature.toByteArray();
        } 
        catch ( NameNotFoundException e )
        { 
            return null; 
        } 
    } 
 
    private static byte[] digestBytesByMD5(final byte[] message)
    { 
        try 
        { 
            final MessageDigest digest = MessageDigest.getInstance("MD5");
            return digest.digest(message);
        } 
4
CodeRank

Related Signature toByteArray Questions & Answers:

toByteArray Method Overview
See Code Examples for other Android Signature Methods: